默认重写规则php


php默认重写rewrite规则

apache

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

nginx

if (!-e $request_filename) {
    rewrite ^(.*)$ /index.php?s=/$1 last;
    break;
}

thinkphp的tp6下nginx参考:

location / {
   if (!-e $request_filename) {
           rewrite  ^(.*)$  /index.php?s=/$1  last;
    }
}

版权声明,转载请附上原文链接及本声明: https://blog.yongit.com/note/101676.html