【发布时间】:2011-08-12 04:50:04
【问题描述】:
第二天与使用 mod_rewrite 的问题作斗争。
系统操作系统:Windows XP HTTP 服务器:Apache 2.2 httpd
来自 httpd.conf 的一些相关行
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
DocumentRoot "N:/Web-dev/www"
<Directory "/">
Options Indexes +FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory "N:/Web-dev/www">
Options Indexes +FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
.htaccess 包含:
RewriteEngine on
RewriteRule ^alice.html$ bob.html
php 信息说
Loaded Modules core mod_win32 mpm_winnt http_core mod_so mod_actions mod_alias mod_asis mod_auth_basic mod_authn_default mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dir mod_env mod_include mod_isapi mod_log_config mod_mime mod_negotiation mod_setenvif mod_rewrite mod_proxy mod_php5
两个文件都存在,正在加载alice.html,它仍然加载它,在rewrite.log中,它显示:
127.0.0.1 - - [25/Apr/2011:11:01:27 +0300] [localhost/sid#7b5148][rid#2bc70b0/initial] (1) [perdir N:/Web-dev/www/] pass through N:/Web-dev/www/alice.html
我试过测试,如果它正在读取.htaccess文件,通过添加一些乱码来重写引擎命令,结果证明:
[Mon Apr 25 10:47:04 2011] [alert] [client 127.0.0.1] N:/Web-dev/www/.htaccess: Invalid command 'ReDELETEMEwriteEngine', perhaps misspelled or defined by a module not included in the server configuration
但是,对于 RewriteRule 来说,同样的做法不会改变任何事情,就像它忽略那些一样。我没办法了,怎么办!?
【问题讨论】:
-
该文件是否真的称为
alice.html而不是Alice.html或类似名称?案件很重要。 -
应该移到 serverfault.com
-
@joschi 是的,文件真的叫 alice.html,可以打开。我在这里看到了其他相关问题,希望有人能帮助...
-
感谢您提醒我这一点。隐藏空格和字符编码问题。
标签: apache mod-rewrite