Forum Moderators: phranque

Message Too Old, No Replies

htaccess rewrite sudomain to variable

htaccess rewrite sudomain to variable

         

Achilles08

6:50 am on Sep 19, 2011 (gmt 0)

10+ Year Member



Hello,

i have a site with php application which writes/uses subdomain to a variable. I have tried couple of rules but nothing worked out. here is htaccess code


Options +FollowSymLinks

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteBase /appfolder/
RewriteCond %{HTTP_HOST} !www.site.com:8888$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).site.com:8888 [NC]
RewriteRule (.*) /index.php?var1=home&var2=start&var3=%2 [NC,QSA]

here i want to grab subdomain value to var=3...please help

Thanks in advance

g1smd

7:00 am on Sep 19, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your first two RewriteConds have no associated RewriteRule.

Escape all the literal periods (. becomes \.) in the patterns, othersise your pattern is ambiguous.

The code must be placed in the internal server locations that all the subdomains resolve to and you'll also need to have altered the DNS settings to allow wildcard subdomains.

Add the [L] flag to the rule.

Achilles08

7:02 am on Sep 19, 2011 (gmt 0)

10+ Year Member



thanks for reply...i think i got it worked