极致CMS 伪静态问题
问题及现象
极致CMS部署完成之后发现访问首页是正常的
但是首页上点击其他链接都报错404
路径中加上index.php后访问又是正常的
解决方法
伪静态问题,需要在nginx配置文件中加上:
location / { if (!-e $request_filename){ rewrite ^(.*)$ /index.php?s=$1 last; break; }}
顺便找了一下其他中间件的伪静态:
Apache:
<IfModule mod_rewrite.c> RewriteEngine on RewriteBase / #RewriteCond %{REQUEST_URI} !((.*).jpg|.jpeg|.bmp|.gif|.png|.js|.css|.tts|.woff )$ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f #RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L] RewriteRule ^(.*)$ index.php [E=PATH_INFO:$1,QSA,PT,L]</IfModule>
IIS:
<?xml version="1.0" encoding="UTF-8"?><configuration> <system.webServer> <rewrite> <rules> <rule name="allow_rules" enabled="true" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" /> </rule> </rules> </rewrite> </system.webServer></configuration>