.htaccess causes issues in sub-folders

梦想与她 提交于 2019-12-24 10:49:11

问题


Here is my .htaccess to rewrite public/index.php I'm using the Laravel php framework.

<IfModule mod_rewrite.c>
    RewriteEngine On 
    RewriteBase /
    RewriteCond %{THE_REQUEST} /(code|tmp) [NC]
    RewriteRule ^ - [L]
    RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
</IfModule>

Here the folders 'code' and 'tmp' can be accessed like normal.

If I add a set of nested folders, and add the default Laravel htaccess to remove the public/index.php

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

It doesn't work inside the nested folder.

It works good if I don't have the firstly given .htaccess in the root directory. Once I given my .htaccess it is not working.

Is the .htaccess in the root directory causing effect to the sub folder ?

If so , how can I fix that

Note : This is the question where I got .htaccess previously

.htaccess exception makes issue on main directory

来源:https://stackoverflow.com/questions/28053569/htaccess-causes-issues-in-sub-folders

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!