0

I have list of url's to redirect using htaccess. from my OLD domain to New domain.

i have done this in my htaccess

RewriteEngine on
RewriteCond %{HTTP_HOST} !^sub.domain1.com$
RewriteRule ^(.*)$ http://domain2.com/$1 [R=301,L]

RewriteEngine on
RewriteCond %{HTTP_HOST} !^sub.domain1.com$
RewriteRule ^(.*)$ http://www.domain2.com/$1 [R=301,L]

redirection working fine, But i want something like http://sub.domain1.com/old-page to http://www.domain2.com/my-new-page

and i did this.

RewriteEngine on
RewriteCond %{HTTP_HOST} !^sub.domain1.com/old-page/$
RewriteRule ^(.*)$ http://www.domain2.com/my-new-page/$1 [R=301,L]

and the url is http://www.domain2.com/old-page/

please help

1 Answer 1

1

Try this:

RewriteEngine on 
RewriteRule ^old-page/(.*)$ http://www.domain2.com/my-new-page/$1 [R=301,L]

Works on my test.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.