apache - Redirect index page to different file then the rest of the redirects using htaccess -
not sure how pull off. have example.com , example2.com. want requests example2.com 301 redirect example.com. part isn't hard.
rewritecond %{http_host} ^example2.com [nc,or] rewritecond %{http_host} ^www.example2.com [nc] rewriterule ^(.*)$ http://www.example.com/$1 [l,r=301,nc] what though when enters www.example2.com have them redirected www.example.com/a-special-page.html , have else redirect entered. ie www.example2.com/another-page.html redirects www.example.com/another-page.html
have specific redirect first , generic redirect this:
rewriteengine on rewritecond %{http_host} ^(www\.)?example2\.com$ [nc] rewriterule ^/?$ http://www.example.com/a-special-page.html [l,r=301] rewritecond %{http_host} ^(www\.)?example2\.com$ [nc] rewriterule ^(.*)$ http://www.example.com/$1 [l,r=301] make sure test after clearing browser cache.
Comments
Post a Comment