I have the following htaccess file:
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteCond %{REQUEST_URI} !^/site/v1/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /site/v1/$1
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteRule ^(/)?$ site/v1/ [L]
So when I access either domain.com
or www.domain.com
, I go directly to domain.com/site/v1
, without the /site/v1
part showing on the browser.
But my problem is that inside the site/v1
folder, there's a admin
folder, containing the website's CMS, and when I access domain.com/admin
, it redirects to domain.com/site/v1/admin
, with the /site/v1
part being displayed on the browser.
So, my question is, how I can get to access the /site/v1/admin
folder without displaying all the path, i.e., when I access domain.com/admin
, it access the subfolder, but doesn't display it?
In other format, I have:
- I access domain.com/about
- On the server side, I'm actually at domain.com/site/v1/about
- On my browser I see domain.com/about
- ps: about
here is a parameter being passed to my back-end via a RewriteCond directive (on another piece of code), not being a folder (but it works just as well with a folder)
What I too have:
- I access domain.com/admin
- On the server side, I'm actually at domain.com/site/v1/admin
- On my browser I see domain.com/site/v1/admin
What I want:
- The last item before to be "I see domain.com/admin
"
Thank you!
EDIT
Here's my full htaccess file after the changes:
# force ssl
RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteCond %{REQUEST_URI} !^/site/v1/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /site/v1/$1
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteRule ^admin/$ /site/v1/admin/ [L]
RewriteRule ^(/)?$ site/v1/ [L]