htaccess的重写和权威性冲突 [英] htaccess rewrite and auth conflict

查看:126
本文介绍了htaccess的重写和权威性冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我每次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?

这篇关于htaccess的重写和权威性冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆