🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
X1因为是基于thinkphp开发的,所以伪静态的设置就是thinkphp的设置 其实我们这里X1设置伪静态也就是为了隐藏index.php而设置,其他的url美化路径,修改后缀如html等都是通过路由来设置了 伪静态配置好后,这里才可以设置,否则网站打开会出现错误,或者永远是首页 ![](https://img.kancloud.cn/e9/6e/e96e8dcc8801e7a96a90a8359f0200fd_705x128.png) 不同的web服务器设置不同,以下列举常用的搭配设置,其他的略去不提 我们常用的web服务器:Apache、IIS、nginx三种,应该是目前最多的 一般就是这几种搭配 linux+apache 、linux+nginx、win+iis、win+apache  win+nginx都很少了。 linux+apache环境,直接设置.htaccess, 用thinkphp官方提供的默认即可,如下: ~~~ <IfModule mod_rewrite.c>   Options +FollowSymlinks -Multiviews   RewriteEngine On   RewriteCond %{REQUEST_FILENAME} !-d   RewriteCond %{REQUEST_FILENAME} !-f   RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] </IfModule> ~~~ win+apache环境  比如phpstudy这种套件配置的环境,也是设置.htaccess但是有些特别,如果是全新安装,那就不用配置,直接使用x1里默认的即可 ~~~ <IfModule mod_rewrite.c>   Options +FollowSymlinks -Multiviews   RewriteEngine On   RewriteCond %{REQUEST_FILENAME} !-d   RewriteCond %{REQUEST_FILENAME} !-f   RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1] </IfModule> ~~~ Linux+Nginx环境 也是直接用thinkphp官方提供的配置即可,nginx是在站点的conf里配置,如果是虚拟主机,在vhost中配置xxx.conf然后include xxx.conf,当然写入到具体站点的conf里也是可以的 ~~~ location / {    if (!-e $request_filename) {    rewrite  ^(.*)$  /index.php?s=/$1  last;    break;     }  } ~~~ Win+IIS环境  IIS可能有些人觉得是最麻烦的,其实直接复制代码也很简单,IIS7.5以上配置web.config即可。当然前提是服务器需要安装url\_rewrite web.config如果没有其他配置,直接复制下面完整的代码到web.config就可以了,如果web.config有其他的配置,需要注意rules的嵌套。IIS7以下的环境就忽略了,建议升级系统吧。 ~~~ <?xml version="1.0" encoding="UTF-8"?>   <configuration>     <system.webServer>       <rewrite>         <rules>           <rule name="WPurls" enabled="true" 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:0}" />           </rule>         </rules>       </rewrite>     </system.webServer>   </configuration> ~~~