Forum Moderators: phranque
I need to have example2.com rewritten so that it redirects to www.example2.com
Problem
Using an .htaccess file example I found online, the following occurs:
As you can see, there are inheritance issues. example2.com is inheriting the subdirectory of example.com.
Does anyone know how to alter my .htaccess file so that the rewrite conditions do not cause inheritance of the example subdirectory?
Also, I'm using the following code in my .htaccess file ( which is located in example's main directory... http://www.example.com/.htaccess )
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example2.com [NC]
RewriteRule ^(.*)$ http://www.example2.com/$1 [R=301,L]
I understand half of that code. I just copied it from somewhere else online. Can someone provide me with any solutions?
Do I need to put another .htaccess file in the subdirectory with the RewriteEngine Off?
Thanks
[edited by: jdMorgan at 3:30 pm (utc) on Jan. 5, 2010]
[edit reason] example.com [/edit]
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^example2.com [NC]
RewriteRule ^(.*)$ http://www.example2.com/$1 [R=301,L]
Still, if someone that has a better knowledge of writing .htaccess files, has anything to add here, that would be great too. For example, does anyone see anything wrong with that code?
[edited by: jdMorgan at 3:32 pm (utc) on Jan. 5, 2010]
[edit reason] example.com [/edit]