开发者

mod_alias subdirectory replacement

I am using Rewrite开发者_运维技巧Match to redirect all traffic from subdir1 to subdir2, while keeping all other parts of the url the same. So for instance,

http://www.mydomain.com/subdir1/

would redirect to

http://www.mydomain.com/subdir2/

I am using this rule:

RedirectMatch 302 /subdir1/.* /subdir2/$1

which works for the url

http://www.mydomain.com/subdir1/

but not for any pages with longer urls. So it is not matching

http://www.mydomain.com/subdir1/index.htm

which should be redirected to

http://www.mydomain.com/subdir2/index.htm

If anyone has any ideas, I'd appreciate it.


Does this thread help at all? http://www.webmasterworld.com/forum92/4097.htm


You would need to round brackets around your .*

RedirectMatch 302 /subdir1/(.*) /subdir2/$1

Without that $1 is meaningless and is not going to 'know' what to match on.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜