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]