I am trying to write htaccess file that would convert
http://subdomain.my-tld.com/
to
http://my-tld.com/file.php?var=subdomain
Notice the hyphen in the tld.
Here's the htaccess I am using:
Options +FollowSymLinks
Options -Indexes
RewriteEngine On
# Rewrite sub domains.
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^www\.my-tld\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.my-tld\.com$ [NC]
RewriteRule ^(.*)$ /file.php?var=%2 [QSA,L]
I am using the very same code for another domain in the very same server and it is working great, but it is not for this domain. I am guessing that the problem is with the hyphen in this domain.
Any suggestions?