tp6访问的时候省略index.php

apache添加的时候可能会遇到  ? 问号的问题,在倒数第二行index.php后面加个?问号

 

对于Apache服务器,确保启用了 mod_rewrite 模块,并在 .htaccess 文件中添加以下重写规则:

 

<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Indexes
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]
</IfModule>

对于Nginx服务器,在 server 配置块中添加以下内容:

 

 

 nginx低版本加这段代码

location ~* (runtime|application)/{
return 403;
}
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}

 

 

 

 

posted @ 2021-12-24 16:28  微不足道小学生  阅读(306)  评论(0)    收藏  举报