由于各个Web服务器使用的地址重写规则语法不同,这里列出常见的几种Web服务器适用的重写规则。
Apache
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
Nginx
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php$1 last;
}
IIS
<!--web.config url rewrite-->
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/index.php/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Caddy(未验证)
try_files {path} {path}/ /index.php/{path}/?{query}
哥哥 回复
2021-09-03 17:58
网站整体还是不错的,唯一遗憾就是缺好看的模板。你有空写几个好看的模板,能吸引更多的人,我也等着用。
我自己也会一点前端知识(html和css),就是JS写不好,如果你有闲空,我还想和你学习前端和后端开发。
关注你了 回复
2021-08-31 16:16
已经看到你的努力了,我已经在用了将来用你这个博客的人会越来越多。现在的问题就是主题太少了。你起码整两个好看的模板(主题)去吸引人嘛?你说是不是?期待你的开发更好的模板,我第一个用。