开发者

Rewrite Conditions in htaccess file

开发者 https://www.devze.com 2023-03-14 09:22 出处:网络
RewriteCond %{HTTP_HOST} ^mysite.com$ RewriteCond %{REQUEST_URI} ^/ex-ex[/]* RewriteRule ^(.*)$ /subsite/ex [R=permanent,L,NE]
RewriteCond %{HTTP_HOST} ^mysite.com$
RewriteCond %{REQUEST_URI} ^/ex-ex[/]*
RewriteRule ^(.*)$ /subsite/ex [R=permanent,L,NE]

I am redirecting mysite.com/ex-ex to mysite.com/subsite/ex

This is working fine, but mysite.com/ex-ex/page1 redirects to mysite.com/subsite/ex. H开发者_开发百科ow can I redirect to mysite.com/subsite/ex/page1?

How can I append the remaining part of url also to new url pattern?


This would do it:

RewriteCond %{HTTP_HOST} ^mysite.com$
RewriteRule ^/ex-ex(.*)$ /subsite/ex$1 [R=permanent,L,NE]

Edit: added a slash in the Rule

0

精彩评论

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