I have a .ne.ro domain (registered in Romania) where visitors can enter with or without 'www':
http://mydomain.ne.ro
http://www.mydomain.ne.ro
I want to redirect http://123.mydomain.ne.ro
to http://mydomain.ne.ro?id=123
. If visitor enter with 'www|mail|ftp' must be treated as non parameter (obviously).
I tried htaccess subdomain redirct with last url parameter but didn't work.
Current code:
# edited on 05/April/2011 as suggested:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.mydomain.ne.ro$
RewriteCond %{HTTP_HOST} ^(.*).mydomain.ne.ro$
RewriteRule ^$ /index.php?id=%1 [R,L]
Hosted on a hostgator's business plan (linux) and registered at nic.ro, just if asking. See Question&Answers more detail:os