Forum Moderators: phranque
RewriteCond %{HTTP_HOST} ^sub.example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.sub.example.com$
RewriteRule ^(.*)$ http://www.example.com/sub[R=301,L] I get the message:
Firefox can't find the server at test.domain.com.
If I tweak this redirect like this it works fine:
RewriteCond %{HTTP_HOST} ^example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^(.*)$ http://www.cnn.com[R=301,L] I am thinking that there is something about my Apache config that is assuming that if the domain is test.domain.com then it must be a subdomain so it ignores the htaccess mod_rewrite code.
I have migrated servers and want to move subdomains to folders so that the domain ssl cert covers the area that was the subdomain. Hence, the need for the rewrite on certain subdomains. Does anybody have any ideas on this?
[edited by: jdMorgan at 2:37 pm (utc) on Dec. 10, 2009]
[edit reason] example.com [/edit]
Jim
I wonder if I can use a *.domain.com dns entry that will pick up all subdomains that are not specifically called out with their own DNS A record?
If it was possible for you to add the "test" subdomain and make it work with no other changes required to the server configuration (e.g. if you didn't have to "add" the test subdomain in Control Panel), then you've already got a dedicated IP address.
But do be careful to handle all of the "undefined" wild-card subdomains as g1smd says, either by 301-redirecting them to the main domain or to an 'error page' on a single domain/subdomain/hostname, or by returning a 403, 404, or 503 server response if an 'undefined' subdomain is requested.
Jim