Forum Moderators: phranque
i have been using this .htaccess for moving subdomain request to a index.php variable
wanted results
http://sometext.example.com
parses out to
http://example.com/file.php?domain=sometext
this is the .htaccess code I'm using to achieve this
Options +FollowSymLinks
rewriteEngine on
rewriteCond %{HTTP_HOST}!^(www\.)?example\.com [NC]
rewriteCond %{HTTP_HOST} ^(.*)\.example\.com [NC]
rewriteRule .* /clientindex.php?username=%1 [L]
i will admit to using a plesk back end witch makes its own sub domain folder which starts outside the normal httpd folder but this rewrite should take care of that (i have me DNS Set to *.example.com -->example.com)
any help in identifying what it is i missed would be a great help
[edited by: Deccypher at 11:53 pm (utc) on Oct. 27, 2008]
You say "I have been using," so it's not clear: Does this code work or not? If so, what is the question? And if not, then what is the problem? -- What are the results you get, and how do they differ from what you want and expect?
Jim
Thanks jdMorgan there was a space issue between "}" and "!". also the was an issue due to not using the full url so the working code is now
rewriteEngine on
rewriteCond %{HTTP_HOST} !^(www\.)?example\.com [NC]
rewriteCond %{HTTP_HOST} ^(.*)\.example\.com [NC]
rewriteRule .* http://example.com/clientindex.php?username=%1 [L]