GoodSp33d
GoodSp33d

Reputation: 6282

Rewrite Conditions in htaccess file

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. How can I redirect to mysite.com/subsite/ex/page1?

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

Upvotes: 0

Views: 72

Answers (1)

aorcsik
aorcsik

Reputation: 15552

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

Upvotes: 1

Related Questions