subdomain redirection

subdomain redirection

Posted by: humaneasy
Posted on: 2006-07-08 03:49:00

Hi,

In my previous hoster I used CPanel and it as a feature that if I don't have a subdomain set up it will redirect automaticaly to the main domain.

Ex:

http://subdomain1.mydomain.com
Subdomain1 was configured to use ~/mydomain.com/subdomain1 so it will work as normal.

http://subdomain2.mydomain.com
Subdomain2 was *not* configured so it will point to ~/mydomain.com and it will work as if subdomain2 was originaly created with exactly the same content as mydomain.com or whatever I decide to pull out.

Basicaly this bellow is *not* working in what concerns subdomain redirection:

ErrorDocument 401 /index.php?e=401
ErrorDocument 403 /index.php?e=403
ErrorDocument 404 /index.php?e=404
ErrorDocument 500 /index.php?e=500
ErrorDocument 503 /index.php?e=503

RewriteEngine On

RewriteCond %{HTTP_HOST}!^(www.)?mydomain.com [NC]
RewriteCond %{HTTP_HOST} ^(.*).mydomain.com [NC]
RewriteRule .* /index.php?s=%1 [L]

RewriteCond %{HTTP_REFERER} !^http://(www.)?mydomain.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .(jpe?g|gif|png)$ - [F,L]

Re: subdomain redirection

Posted by: Raz2133
Posted on: 2006-07-08 05:02:00

In reply to:

a feature that if I don't have a subdomain set up it will redirect automaticaly to the main domain.


It sounds like you are referring to a wildcard DNS record. I don't believe DreamHost supports these on their shared hosting accounts.

Here is a quote from the wiki article on the subject;

"Wildcards... in general, we will not add wildcard DNS records for you on a shared hosting account. This is for a number of reasons. If you have a special request, we'll consider it, provided you truly understand all of the implications of doing this."

Mark

Tags: mydomainphpindexsubdomainhttpredirectioncpaneljpepngredirecthost wwwgifdomain