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

Popular posts from this blog

1111. appearing after print sequence - php -

node.js - Express and Redis - If session exists for this user, don't allow access -

excel - I can't get the attachement of the email PHP -