子文件夹的.htaccess不重写父的.htaccess选项

问题描述 投票:1回答:1

我有我的域的屋顶一个.htaccess所有点击量重定向到index.php

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

#redirect http to https, remove www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

#remove index.php from link
RewriteRule ^index.php$ - [L] 

#redirect to index
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

</IfModule>

#remove direct access to all *.php except index.php
<Files *.php>
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Files>

<Files index.php>
    Order Allow,Deny
    Allow from all
</Files>

一切正常,交通重定向,当文件存在显示文件。

现在我有一个管理员文件夹/管理/与和的index.php和api.php我可以打开/管理/和/admin/index.php但/admin/api.php重定向到的index.php

我试图把一个.htaccess中的/管理内部/像这样:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine Off
RewriteEngine On

#redirect http to https, remove www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

</IfModule>

但得到相同的结果。 /管理/打开,但/admin/api.php重定向到指数

apache .htaccess redirect
1个回答
0
投票

发现问题/溶液。

要添加到里面的需要的.htaccess /管理/

 <Files *>
    Order Allow,Deny
    Allow from all
</Files>
© www.soinside.com 2019 - 2024. All rights reserved.