的Apache Web服务器在Windows 7专业版上运行。 Apache的版本就是Apache / 2.2.17(Win32的)PHP / 5.3.8。 mod_rewrite的是根据加载的phpinfo()
。 <虚拟主机>
标记中包含 RewriteLog
和 RewriteLogLevel 3
指令。日志文件中创建 RewriteLog
指令集。
Apache web server is running under Windows 7 professional. Apache version is Apache/2.2.17 (Win32) PHP/5.3.8. mod_rewrite is loaded according to phpinfo()
. <VirtualHost>
tag contains RewriteLog
and RewriteLogLevel 3
directives. Log file set in RewriteLog
directive is created.
的.htaccess
在根目录下的文件是以下内容:
.htaccess
file in root directory is following:
RewriteEngine On
RewriteRule ^alice.html$ bob.html
当前目录包含 bob.html
文件,它可以打开本地主机地址。
Current directory contains bob.html
file and it can be opened with localhost URL.
但 alice.html
网址不能打开,它会导致错误404。
But alice.html
URL can not be opened, it causes error 404.
有关本网站日志文件包含有关找不到文件只是正常的消息。
Log file for this site contains just normal message about file not found.
重写日志文件存在,但空的。
Rewrite log file exists but empty.
这可能会导致被忽略改写指令?
Which can cause rewrite directives being ignored?
请确保您有这条线在你的httpd.conf:
Make sure you have this line in your httpd.conf:
AllowOverride All
的AllowOverride 控制什么指令可以被放置在.htaccess文件。
AllowOverride controls what directives may be placed in .htaccess files.
测试:要测试的.htaccess是否启用与否,只是把一些垃圾文字,看看它是否产生了500内部错误或不
Testing: To test whether .htaccess is enabled or not, just put some junk text in it and see if it generated a 500 internal error or not.