Rewrite question

Hi,

Let say that i have a website stored in /public_html/subfolder/
.htaccess is stored in /public_html

when user type (in browser) www.mywebsite.com, he should be redirected to /public_html/subfolder/index.html
however user should only see in browser address bar www.mywebsite.com and not www.mywebsite.com/subfolder/

this i solved using:


RewriteBase /

#Rewrites http://www.website.com/subfolder to http://www.website.com/
RewriteCond %{REQUEST_URI} !^/subfolder
RewriteRule ^(.*)$ subfolder/$1 [L]

this works…
now, let say that website allow admin login using /public_html/subfolder/admin/
i would like to display only http://www.website.com/admin/ and not as it is now: http://www.website.com/subfolder/admin/

therefore i was thinking to add to previous code:


#Rewrites http://www.website.com/subfolder/admin/ to http://www.website.com/admin/
RewriteCond %{REQUEST_URI} !^/subfolder/admin/
RewriteRule ^(.*)$ subfolder/admin/$1 [L]

but this does not work.
Any idea where is my mistake ?
thx

Your first rewrite rule should take care of that already. I did a quick test on my local machine to be sure.

Partially it does, but it does not rewrite it well as i have http://www.mywebsite.com/subfolder/admin/
and i would like to have http://www.mywebsite.com/admin/

When I used your rewrite rule on my local machine, it did exactly that. If it isn’t working for you, then there must be something else significant in your htaccess that we haven’t seen.