每次部署到新环境都会忘记,在这里记录一下:
1、httpd.conf配置文件中加载了mod_rewrite.so模块
2、AllowOverride None 将None改为 All
3、conf/config.php中确保URL_MODEL设置为2
4、在项目目录中把.htaccess 文件改成
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
重启Apache
http://<serverName>/index.php/Blog/read/id/1?
就可以通过写成
http://<serverName>/Blog/read/id/1
本文详细介绍了在部署新环境时,遇到的配置问题及其解决方法,包括修改httpd.conf文件加载mod_rewrite模块、允许覆盖配置、确保URL_MODEL设置正确、调整.htaccess文件以实现URL重写,最终成功通过index.php路径访问特定页面。
563

被折叠的 条评论
为什么被折叠?



