so I have the following problem:
I have a webspace and one url www.domain.com
points to the root folder.
I want any request to www.domain.com/app/
to be rewritten to the folder /apps/app/current/public/
(it is a laravel app deployed via capistrano).
However the url should stay as it was, so eg www.domain.com/app/user-page
would be rewritten to /apps/app/current/public/user-page
.
How can I do this with htaccess?
What I currently have:
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /apps/app/current/public/index.php?/$1 [NC,L]
But obviously this only works at domain.com
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^app/(.*)$ /apps/app/current/public/index.php?/$1 [NC,L]
leads to my app receiving app and whatever is after it as the url, howerver, it should only receive whatever is after the app/
.
I got it working, to than notice, that this does not work with laravel, because the /app
part is still in the url.
So as far as I know it does not work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.