>백엔드 개발 >PHP 튜토리얼 >mac 下 apache2 配置 rewrite_mod 问题

mac 下 apache2 配置 rewrite_mod 问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB원래의
2016-06-06 20:44:481003검색

已经在 /etc/apache2/httpd.conf 中

去掉了

<code>LoadModule rewrite_module libexec/apache2/mod_rewrite.so 
</code>

前面的注释符号,phpinfo() 函数显示已加载 rewrite 模块

在 httpd.conf 文件末尾加入

<code>RewriteEngine on
RewriteRule ^/t_(.*).html$ /test.php?id=$1
</code>

进行测试时 rewrite 不起作用, 出现 404 错误

输入地址为:
http://localhost/~gipanda/projects/t_test.html

错误显示:
The requested URL /~gipanda/projects/t_test.html was not found on this server.

请问这是为什呢。。?

回复内容:

已经在 /etc/apache2/httpd.conf 中

去掉了

<code>LoadModule rewrite_module libexec/apache2/mod_rewrite.so 
</code>

前面的注释符号,phpinfo() 函数显示已加载 rewrite 模块

在 httpd.conf 文件末尾加入

<code>RewriteEngine on
RewriteRule ^/t_(.*).html$ /test.php?id=$1
</code>

进行测试时 rewrite 不起作用, 出现 404 错误

输入地址为:
http://localhost/~gipanda/projects/t_test.html

错误显示:
The requested URL /~gipanda/projects/t_test.html was not found on this server.

请问这是为什呢。。?

放到当前项目文件夹下的.htaccess 文件中。

遇到同样的问题请问怎么解决的

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.