Hello there, What I am looking to do is load.... mysub.mydomain.com so it just loads.... mydomain.com Then with php I'm looking to extract the 'mysub' part of the name to a variable. I want the site to always have the subdomain in place though, I don't want it to fully redirect. Any clues? Cheers
<IfModule mod_rewrite.c> RewriteEngineOn RewriteCond %{HTTP_HOST} ^([^.]).mydomain.com RewriteRule ^(.*)$ /$1?subdomain=%1 [QSA,L] </IfModule> Not 100% sure it will work though.
Thanks, can't test it at the moment as I'm not at home. However, I'm not looking to put the subdir name in the url, but looking to use the PHP script to extract the subdomain. Do I even need mod rewrite for this? Can I just set up a wild card for the domain and then extract the subdomain in the script?
Yes, I know. The mod_rewrite solution I posted does not change what the user sees in the address bar.