.htaccess tutorial

htaccess Elite


Moved DocumentRoot

Ask your mod_rewrite and Redirection questions here, and get answers!

Moved DocumentRoot

Postby produke » 30 Oct 2006 20:32

Problem:

Usually the DocumentRoot of the webserver directly relates to the URL "/". But often this data is not really of top-level priority.

For example, you may wish for visitors, on first entering a site, to go to a particular subdirectory /about/. This may be accomplished using the following ruleset:

Solution:

We redirect the URL / to /about/:

Code: Select all
    RewriteEngine on
    RewriteRule   ^/$  /about/  [R]


Note that this can also be handled using the RedirectMatch directive:
Code: Select all
RedirectMatch ^/$ http://example.com/e/www/
User avatar
produke
 
Posts: 242
Joined: 25 Sep 2006 04:48

Return to Redirect or Rewrite Questions