当前位置:Gxlcms > 数据库问题 > ThinkPHP 利用.htaccess文件的 Rewrite 规则隐藏URL中的 index.php

ThinkPHP 利用.htaccess文件的 Rewrite 规则隐藏URL中的 index.php

时间:2021-07-01 10:21:17 帮助过:4人阅读

<IfModule mod_rewrite.c> 2 RewriteEngine on 3 RewriteCond %{REQUEST_FILENAME} !-d 4 RewriteCond %{REQUEST_FILENAME} !-f 5 RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] 6 </IfModule>

重启Apache之后,原来的 http://serverName/index.php/Blog/read/id/1 就可以通过访问 http://serverName/Blog/read/id/1 简化了URL地址。

ThinkPHP 利用.htaccess文件的 Rewrite 规则隐藏URL中的 index.php

标签:

人气教程排行