htaccess的重写和权威性冲突重写、权威性、冲突、htaccess

2023-09-02 09:45:55 作者:面旧。

我每次2目录中一个.htaccess文件:

I have 2 directories each with a .htaccess file:

HTML / htaccess的 - 有一个在这个文件重写发送几乎一切url.php

html/.htaccess - There is a rewrite in this file to send almost everything to url.php

RewriteCond %{REQUEST_URI} !(exported/?|.(php|gif|jpe?g|png|css|js|pdf|doc|xml|ico))$
RewriteRule (.*)$ /url.php [L]

和HTML /导出/的.htaccess

and html/exported/.htaccess

AuthType Basic
AuthName "exported"
AuthUserFile "/home/siteuser/.htpasswd"
require valid-user

如果我删除HTML /导出/ .htaccess中的重写工作正常,导出的目录可以访问。如果我删除HTML / .htaccess中的身份验证工作正常。

If I remove html/exported/.htaccess the rewriting works fine and the exported directory can be access. If I remove html/.htaccess the authentication works fine.

然而,当我有两个出口.htaccess文件/被改写为/url.php。任何想法如何,我可以prevent呢?

However when I have both .htaccess files exported/ is being rewritten to /url.php. Any ideas how I can prevent it?

推荐答案

我想你可能意味着这对你的正则表达式:

I think you may have meant this for your regex:

RewriteCond %{REQUEST_URI} !(^exported/?|.(php|gif|jpe?g|png|css|js|pdf|doc|xml|ico)$)
RewriteRule (.*)$ /url.php [L]

确实 HTML /导出/导出/ 工作在当前设置的任何机会?

Does html/exported/exported/ work in your current setup by any chance?

 
精彩推荐