Directory look like root

Using mod_rewrite to handle various content issues

Directory look like root

Postby peaforabrain » Sat May 10, 2008 3:13 am

Is it posssible to use a website located in a directory, and make it look like its in the root. So all the files located in the folder will work fine, but redirect to the root.

e.g to

Posts: 31
Joined: Sun Mar 11, 2007 9:22 am

Postby richardk » Sun May 11, 2008 12:30 pm

Try the following in a .htaccess file in your document root
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{DOCUMENT_ROOT}/folder%{REQUEST_URI}/ -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

RewriteRule ^(.*)$ /folder/$1 [QSA,L]
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Return to Content

Who is online

Users browsing this forum: No registered users and 4 guests