php - How to redirect all request to subfolder with it's own .htaccess file -
i know such questions has been answered lot of time, neither of found answers works me.
have following url http://dummy.com/api
access root folder going have project (laravel project).
deploying remote hosting have no acceess parent directories.
project (simple laravel project) consists lot of folders, way should placed in parent directories (app,bootstrap,config...
) , public folder main index.php
of laravel project located.
have url http://dummy.com/api/public/index.php
directory includes own .htaccess
file following content.
<ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> options -multiviews </ifmodule> rewriteengine on # redirect trailing slashes if not folder... rewritecond %{request_filename} !-d rewriterule ^(.*)/$ /$1 [l,r=301] # handle front controller... rewriterule ^ - [e=http_authorization:%{http:authorization}] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l
this stuff required laravel.
so need requests http://dummy.com/api
have been redirected public/
subfolder(index.php default).
example http://dummy.com/api/users
should http://dummy.com/api/pulbic/users
.
should transparent user , not changed real url.
have tried lot of different configurations here common .htaccess redirects
but doesn't work me. please create such rules have desired result.
in advance.
try .htaccess in /api/
folder:
rewriteengine on rewritebase /api/ rewriterule ^((?!public/).*)$ public/$1 [l,nc]
Comments
Post a Comment