mod rewrite - Pointing a subdomain to a subfolder using .htaccess -


My webhost automatically sends all requests from * .mydomain.com to upper domain mydomain.com.

I wanted to map a subdomain to a specific folder on my topical domain i.e. to sub.example.com to change the map.com/someFolder ( without address bar) Must be mapped.

After digging around on the net, I came up with it:

Reverteign on RiverBase / Rev.% {HTTP_HOST} ^ (www \.)? [^.] + \. Example \ .com * $ RewriteRule (. *) Http: // Example.com/myfolder/$1 [L]

It works well, except for a problem: when I enter URL sub If I go to example.com, the URL changes in the example.com/myfolder in the address bar, but when I do something like sub.example.com/login - this map is called "example.com/sub/login" Without making changes in the bar Any help greatly appreciated!

Only small changes are required:

  Rewrite on rewrite / Rewrite% {HTTP_HOST} ^ (www ..)? [^.] + \. Example \ .com * $ RewriteRule (. *) Myfolder / $ 1 [L]  

On the http: // rule, which asks Apache to send the redirect header instead of the appropriate server-side rewrite.


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -