Forum Moderators: phranque
That is my current 301.
I just added a subdomain for a different section in the site
customers.example.com
(index.htm redirects to /)
But when I type that into browser, i'm getting redirected to
www.example.com/customers/
How would i fix that?
The answer to that depends on exactly what you mean by this:
> I just added a subdomain for a different section in the site
It is very likely that the code you used (or that perhaps your control panel created) when you added the subdomain is responsible for this problem, since the code you are using (as posted above) has nothing to do with subdomain requests.
Jim
That I believe is where my problem lies..
When i type in [customers.example.com...] my URL stays the same, (plus I think they now have DNS enabled on hosting now)
But anywhoo... the address [customers.example.com...] stays fine yay!
The address [customers...] redirects to
http://www.example.com/customers/
So by looking at the rewrite, would i want it to say?
RewriteCond %{THE_REQUEST} ^.*\/index\.htm?
RewriteRule ^(.*)index\.html?$ ^.example.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} [^\?]*/index\.html?
RewriteRule ^(([^/]+/)*)index\.html?$ http://%{HTTP_HOST}/$1 [R=301,L]
Jim
I created the .htaccess file in the \customers folder and added the following to it:
RewriteEngine on
RewriteCond %{THE_REQUEST} ^.*\/index\.htm?
RewriteRule ^(.*)index\.html?$ [customers.example.com...] [R=301,L]
And, of course everything 301's perfectly.
My example.com 301's to www.example.com
My www.example.com/index.htm 301's to www.example.com
My customers.example.com/index.htm 301's to customers.example.com
All pages work, no 404's so it was a good day. Since all robots are blocked from \ with the exception of msn, yahoo google, ask and ia_archive, I would imagine that the subdomain should be crawlable as well, but I will put my bot-trap up there as well.
Hope this helps out anyone, thanks for the nudge in the right direction Jim, have a good week.