Forum Moderators: phranque
I have a very unique problem. I have reorganized my directories and have been able to get the main site working the way I want it. But now 2 of my other directories are also redirect to my one site. The other directories are separate sites which no longer come in. I'm not sure if it's because I redirected the http://example.com to redirect to http://www.example.com or if it's something altogether different. I have tried many things and nothing works. Just to give you an idea, eggs-sample.com now redirects to example.com.com. How can I make my directories come in correctly using .htaccess file?
Thanks,
modine
[edited by: jdMorgan at 9:49 pm (utc) on June 5, 2007]
[edit reason] Example.com [/edit]
Please post the code you're using after changing all domain names/hostnames to example.com, example.net, etc. If you need more 'safe' domains, then please use WebmasterWorld.com, cnn.com, and other well-know domains, and not your own. This is for your protection as well as that of all of our members.
Thanks,
Jim
IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.example.com
AuthUserFile /www3/example/_vti_pvt/service.pwd
AuthGroupFile /www3/example/_vti_pvt/service.grp
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST}!^www.example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
Redirect 301 /store2/ http://www.example.com/
Replace the last three lines with this:
RewriteRule ^store2/(.*)$ http://www.example.com/$1 [R=301,L]
#
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^([^.]+\.)*example\.com
RewriteRule (.*) http://www.example.com/$1 [L,R=301]
By changing the logic of the non-www example.com detection, we avoid any redirection of your other hosted domains.
Otherwise, the function is identical.
You may wish to duplicate the canonicalization code for your other domains as well. Or, if all of your domains are canonicalized to the "www" version, you could do something like this:
RewriteRule ^store2/(.*)$ http://www.example.com/$1 [R=301,L]
#
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^([^.]+\.)*(example\.com¦2nd-domain\.com¦3rd-domain\.net)
RewriteRule (.*) http://www.%2/$1 [L,R=301]
For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim