【发布时间】:2010-04-09 09:53:40
【问题描述】:
我在前端有一个 Apache,它应该通过 RewriteRule 重定向请求。
我必须在重定向请求之前进行基本身份验证,所以我把它放在配置文件中:
<VirtualHost *:443>
ServerAdmin xxxxxx
DocumentRoot /var/www/html/
ServerName xxxxxxx
RewriteEngine on
ErrorLog logs/error.log
CustomLog logs/access_log common
<Directory /var/www/html/>
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/httpd/conf/tag.pwd
Require valid-user
RewriteRule ^/(.*) http://xxxxxx:xxx/$1 [P,L]
</Directory>
</VirtualHost>
但它不起作用。
有什么建议吗?
更新:我希望身份验证后的所有请求都将使用规则RewriteRule ^/(.*) xxxxxx:xxx/$1 [P,L] 重定向,但这不会发生。 Apache搜索/var/www/html下的页面
【问题讨论】:
-
您预计会发生什么?究竟发生了什么?你做了什么来实现它?你还尝试了什么?
-
我希望身份验证后的所有请求都将使用规则 RewriteRule ^/(.*) xxxxxx:xxx/$1 [P,L] 重定向,但这不会发生 Apache 在 /var 下搜索页面/www/html
标签: apache mod-rewrite basic-authentication