.htaccess causes problems in subfolders

Here is my .htaccess for rewriting public / index.php I am 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 you can access the folders "code" and "tmp", as usual.

If I add a set of subfolders and add htaccess by default Laravel to remove 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 does not work inside a subfolder.

This works well if I don't have the first .htaccess given in the root directory. As soon as I gave my .htaccess, it does not work.

Is .htaccess in the root directory causing the effect for the subfolder?

If so, how can I fix this

Note. This is a question when I received .htaccess earlier

. .Htaccess exception makes problem in main directory

+1

All Articles