PDA

View Full Version : Removing a directory from a URL with modrewrite


betoranaldi
11-20-2009, 04:53 AM
Hello all, I am looking to remove a directory from a URL and am not having any success.

I have a web application that has the following structure:

http://domain.com/app/admin
http://domain.com/app/user
etc.

I would like to hide the app directory so that its just domain.com/admin and domain.com/user.

I have been fooling around with .htaccess for a little over 3 hours and just can't get it to work.

This is where I am at:


RewriteBase /
RewriteCond %{REQUEST_URI} ^app [NC]
RewriteRule ^app/(.*)$ http://domain.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^domain\.com [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !(.*)app
RewriteRule ^(.*)$ /app/$1 [L]


What am I missing or doing wrong? It seems like it should be pretty simple.