Forum Moderators: phranque
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?sub.domain.com$ [NC]
RewriteRule ^(.*)$ [domain.us...] [L,R=permanent]
to rewrite "sub.domain.com" to domain.us.
It works but only if someone goes to sub.domain.com, sub.domain.com/dir/. If they go to sub.domain.com/dir/filename.htm or sub.domain.com/dir they get redirected to the main index. And if there isn't a trailing slash, it results in a 500 error. I'm so lost trying to fix this. Any suggestions?
I'm going to take a guess and say that some popular hosting company has set up their httpd.conf with UseCanonicalName set to "on" and an incorrect canonical name for each their hosted users. The canonical name is either missing a trailing slash when it should have one, or it has a trailing slash and should not.
The same thing can probably happen due to similar errors setting up name-based mass virtual hosting.
If anyone has a test server and can test this, it might help out a lot of people.
JIm