thinkphp3.2 url更改重写模式,解决index.php去除不了
标签: thinkphp 重写 index.php去除不了 php7.3.4
TP更改url模式有4中:
普通模式 0
PATHINFO模式 1
REWRITE模式 2
兼容模式 3
Apache的配置:
1、httpd.conf配置文抄件中加载了mod_rewrite.so模块;
2、AllowOverride None 将None改为 All;
主要更改重写模式rewrite
1、开启apache的重写模块:http-config文件然后查找:mod_rewrite.so 去掉前面的注释即可。
2、AllowOverride None 将None改为 All; 【全部的】
3、更改URL_MODEL=2;文件位置:thinkphp/conf/convention.php。
4、更改入口位置的.htaccess 文件,更改如下:
< IfModule mod_rewrite.c>
RewriteEngine on RewriteCond
%{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
#注意:这里是5.6以下使用方式RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
#5.6以上版本使用这个
</IfModule>
5、重启apache即可该文章是测试