php - mac 下 apache2 配置 rewrite_mod 问题
天蓬老师
天蓬老师 2017-04-10 14:51:14
[PHP讨论组]

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

去掉了

LoadModule rewrite_module libexec/apache2/mod_rewrite.so 

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

在 httpd.conf 文件末尾加入

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

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

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

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

请问这是为什呢。。?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

全部回复(3)
黄舟

无意中看到的以前自己提的这个问题, 顺便贴下答案
需要在 .htaccess 或 apache 配置文件中添加
Options +FollowSymlinks

天蓬老师

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

伊谢尔伦

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

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号