Forum Moderators: phranque
here is what in the .htaccess
RewriteEngine on
rewriterule ^\.htaccess$ - [F]
RewriteCond %{http_host} !^www\.
RewriteCond %{http_host} ^([^.]+)\.example\.net
RewriteCond $1 !^lv_
rewriterule (.*) /lv_%1/$1 [L]
but , when i upload the .htaccess to the root
when i visite [aaa.example.net...] or [lll.example.net...]
it go to one same page ,the page is root indexpage,why?
is the spaces problem?
[edited by: jdMorgan at 5:26 am (utc) on Dec. 23, 2006]
[edit reason] Examplified [/edit]
RewriteEngine on
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.net
RewriteCond $1 !^lv_
RewriteRule (.*) /lv_%1/$1 [L]
RewriteRule ^foo\.html$ /bar.html [R=301,L]
By the way, your code should rewrite requests for aaa.example.net/xyz to /lv_aaa/xyz
Here, the "lv_" prefix is used to prevent rewriterule recursion in .htaccess. For another method to achieve the same thing without having to use the directory prefix, see this recent thread [webmasterworld.com].
Also, always flush your browser cache before testing any change to your server configuration code. You must explicitly flush it; reloading the page or restarting the browser won't necessarily work.
Jim
it work well
but write .htaccess:
RewriteEngine on
Rewritebase /dvd-creator/
RewriteCond %{ENV:rwdone}!^yes$
RewriteCond %{HTTP_HOST}!www\.dvd-creator\.net
RewriteCond %{HTTP_HOST} ^(www\.)?([a-z0-9\-]+)\.dvd-creator\.net
RewriteRule (.*) /%2/$1 [E=rwdone:yes,L]
it can't work!
every url all go to one page ,i don't know why?