bahattab
05-12-2009, 06:55 PM
Undefined subdomains
If you use wildcard subdomains so that any subdomain will go to your domain name, you can use this code to strip off the subdomain. The url will then show your domain name without the undefined subdomain.
The www subdomain and access by an IP address is excluded.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)\.([^\.]+\.[^\.]+)$
RewriteCond %1 !^(www)$
RewriteCond %{HTTP_HOST} !^[0-9\.]+$
RewriteRule ^(.*)$ http://%2/$1 [R,L]
http://tips-scripts.com/undefined
If you use wildcard subdomains so that any subdomain will go to your domain name, you can use this code to strip off the subdomain. The url will then show your domain name without the undefined subdomain.
The www subdomain and access by an IP address is excluded.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)\.([^\.]+\.[^\.]+)$
RewriteCond %1 !^(www)$
RewriteCond %{HTTP_HOST} !^[0-9\.]+$
RewriteRule ^(.*)$ http://%2/$1 [R,L]
http://tips-scripts.com/undefined