开发者

mod_alias subdirectory replacement

开发者 https://www.devze.com 2022-12-13 11:31 出处:网络
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,

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

精彩评论

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