Home > Backend Development > PHP Tutorial > mac 下 apache2 配置 rewrite_mod 问题

mac 下 apache2 配置 rewrite_mod 问题

WBOY
Release: 2016-06-06 20:44:48
Original
943 people have browsed it

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

去掉了

<code>LoadModule rewrite_module libexec/apache2/mod_rewrite.so 
</code>
Copy after login
Copy after login

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

在 httpd.conf 文件末尾加入

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

进行测试时 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>
Copy after login
Copy after login

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

在 httpd.conf 文件末尾加入

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

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

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

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

请问这是为什呢。。?

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

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template