Here’s the code I have in my .htaccess file right now:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^centerforpolicyanalysis.org$ [OR]
RewriteCond %{HTTP_HOST} ^www.centerforpolicyanalysis.org$
RewriteRule ^(.*)$ "http\:\/\/www\.equalhealth\.info$1" [R=301,L]
I want to redirect everyone who visits http://(www.)centerforpolicyanalysis.org to http://www.equalhealth.info
it works fine if that’s all you type in the url, but if you type a subdirectory, it fails.
here’s what I’m getting:
I type
http://www.centerforpolicyanalysis.org/index.php/2011/06/recommendations-for-preventive-services-to-women-and-girls/
and I get
http://www.equalhealth.infoindex.php/2011/06/recommendations-for-preventive-services-to-women-and-girls/
And it breaks. How do I get it to keep the trailing slash on the domain name on redirect?
Change your code to this: