ThinkPHP的URL中默认要带上index.php,非常不美观。
这时设置一个.htaccess对URL进行重写,同时开启Apache中对应的mod_rewrite模块,即可以解决此问题。
如下:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
本文介绍如何通过配置.htaccess文件及启用Apache的mod_rewrite模块来去除ThinkPHP URL中的index.php,实现更加美观的URL。
1202

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



