Forum Moderators: phranque

Message Too Old, No Replies

Virtual Subdomains [Question]

         

FlashPack

4:34 pm on Mar 7, 2011 (gmt 0)

10+ Year Member



Hi
This code will rewrite any supdomain except (www|mail|ftp) to the file "user_site.php"

RewriteCond %{HTTP_HOST} !^(www|mail|ftp)?\.?example.com [NC]
RewriteRule ^(.*)$ /user_site.php/$1 [L]


if the subdomain is www or empty , i want to rewrite it to home_site.php

I'm not experienced with .htaccess so how can i do that ?

Thanks

FlashPack

10:52 am on Mar 8, 2011 (gmt 0)

10+ Year Member



is it so complicated ?

FlashPack

11:03 am on Mar 8, 2011 (gmt 0)

10+ Year Member



I've found it after some digging :

RewriteCond %{HTTP_HOST} ^(www)?\.?example.com [NC]
RewriteRule ^(.*)$ /home_site.php/$1 [L]
RewriteCond %{HTTP_HOST} !^(www|mail|ftp)?\.?example.com [NC]
RewriteRule ^(.*)$ /user_site.php/$1 [L]


If anyone has a better approach ,post it here .

jdMorgan

6:59 pm on Mar 9, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC]
RewriteRule ^(.*)$ /home_site.php/$1 [L]
#
RewriteCond %{HTTP_HOST} !^(((www|mail|ftp)\.)?example.com)?$
RewriteRule ^(.*)$ /user_site.php/$1 [L]

Jim