mod_rewrite的错误:[客户127.0.0.1]文件不存在 [英] mod_rewrite error: [client 127.0.0.1] File does not exist
问题描述
我要开始使用mod_rewrite这样我就可以在未来使用友好的URL。即时通讯在我的本地开发测试所有。环境,但我不是任何运气得到模块的工作!
I want to start using mod_rewrite so i can use friendly url's in the future. Im testing all in my localhost dev. environment but, Im not having any luck getting the module to work!
我的模块已启用(Apache的重新启动):
My modules is enabled (apache restarted):
LoadModule rewrite_module modules/mod_rewrite.so
在我的Apache安装目录下的模块文件夹中存在一个名为mod_rewrite.so文件
The file named mod_rewrite.so exists under the modules folder in my Apache installation directory
我建立在C名为.htaccess的文件:/的public_html /
I've created a file named .htaccess under c:/public_html/
有关测试的目的,香港专业教育学院建立了我的第一个规则,像这样:
For testing purposes, ive created my first rules like so:
RewriteEngine On
# Translate my-product.html to /product.php?id=123
RewriteRule ^my-product\.html$ /product.php?id=123
有关测试的目的,product.php是非常简单的:
for testing purposes, the product.php is extremely simple:
<?php
// display product details
echo 'You have selected product #' . $_GET['id'];
?>
当我加载 HTTP://localhost/my-product.html 我得到的错误:
When i load http://localhost/my-product.html I get the error:
The requested URL /my-product.html was not found on this server.
当我去查看日志,我看到:
When i go see the log, i see:
[Thu Sep 22 02:37:49 2011] [error] [client 127.0.0.1] File does not exist: C:/public_html/my-product.html
它看起来像它不承认的.htaccess规则可言!
It looks like it doesn't recognize the .htaccess rule at all!
我不知道下一步该怎么做,我觉得我已经应用了所有simpliest规则开始使用mod_rewrite的,但没有运气!
I'm not sure what to do next, i feel i've applied all the simpliest rules to get started with mod_rewrite but with no luck!
帮助!
谢谢 马可
推荐答案
你改变在httpd.conf文件中的AllowOverride属性设置为所有。
Have you changed the Allowoverride property in httpd.conf file to 'All'.
要检查您的服务器mod-rewrite是否启用,加载的phpinfo文件,然后搜索mod_rewrite的扩展。
To check whether the mod-rewrite is enabled in your server, load the phpinfo file and search for the mod_rewrite extension.
这篇关于mod_rewrite的错误:[客户127.0.0.1]文件不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!