Hey everyone, Hope this isn't too basic, I'm having an issue with a mod rewrite of an add on domain hosted on Lunar Pages. Because it is an add-on domain to my main hosting account, the add-on domain appears in a folder off of my domain root. Since I have a mod rewrite for the main domain (everything with a www), the rewrite is affecting the add-on domains creating an unrecognizable address. The bad mod rewrite address looks something like this: www.addondomain.com/addondomain.com I've tried to edit my .htaccess as follows: RewriteCond %{HTTP_HOST} !^www\. RewriteCond %{HTTP_HOST} ^maindomain$ [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] Code (markup): My attempted logic above is to force the rewrite only with a match to maindomain... Any thoughts on how to better achieve this? Thanks
RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^www\.maindomain\.com [NC] RewriteRule (.*) http://www.maindomain.com/$1 [R=301,L] Code (markup):
Actually, I'm getting the code to work now. I thought that my browser had been refreshed (looking for a new version of the page each time)... but maybe wasn't. Lol, of course now it seems to be working... Thank you snatcher and everyone for your thoughts.
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] </IfModule> Code (markup): this one will work best for all cases