.htaccess help
Can someone please help me with making a .htaccess file that does these 2 things:
- redirects http://example.com to http://www.example.com
- redirects http://example.com/index.php and http://www.example.com/index.php TO http://www.example.com
The code below does this, but there's a problem. It only works on the primary domain on my hosting account (hostgator). If I try to put in on an addon domain, i.e. a separate domain name but on the same hosting account, it doesn't work. It screws up my main domain.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1[R=301,L]
RewriteCond %{THE_REQUEST} /index\.html [NC]
RewriteRule ^(.*/)?index\.html$ /$1 [R=301,L]
RewriteRule ^(.+)/$ /$1 [R=301,L]
Anyone know how to make this work on an addon domain in a hostgator account?
Btw, if you want to swipe the code above, feel free. It's pretty nice.
Web Hosting Coupons, Deals & Promos!
Need a Virtual Private Server? www.VPSPlan.com