ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
>  火端搜索程序2.x版伪静态全新调整了,更简单的规则,后台随时自定义伪静态规则,不用再手动修改文件。目录格式还是.html后缀模式有你决定! ~~~ 例如: /k/关键词 后台应设置 k/{q} 和 k/{q}/{p} /关键词.html 后台应设置 {q}.html 和 {q}_{p}.html /s/关键词.html 后台应设置 s/{q}.html 和 s/{q}_{p}.html 还可以吧“关键词”base64转码,例如: /5YWz6ZSu6KN.html 后台应设置 {qe}.html 和 {qe}_{p}.html ~~~ ### 简单设置伪静态的方法: > 1、如果你的环境是Apache 请直接移动程序里伪静态文件夹下的.htaccess文件到根目录来 > 2、如果你的环境是IIS7.5或者以上版本 请直接移动程序里伪静态文件夹下的.htaccess文件和web.config到根目录来 >3、如果你的环境是Nginx 请复制程序里伪静态文件夹下的nginx.txt文件里面的内容到站点配置文件里,然后重启Nginx。如下图: ![](http://www.huoduan.com/content/upload/image/20160701/20160701195233_86564.jpg) > 4、如果你的环境是IIS6.0 ~~~     请复制程序里伪静态文件夹下的.htaccess文件和httpd.ini到根目录来,由于IIS6下伪静态组件不一样,不一定支持,建议不要使用Win2003+IIS6这种已经淘汰的环境了。 ~~~ **在后台设置伪静态规则的时候,建议使用“/”或者“_”这两个字符来分割,不要用其它特殊字符,以免冲突出错** > 2.X的程序里已经包含了伪静态规则 * Nginx版: ~~~ if (!-e $request_filename) { rewrite /(.*) /index.php?rewrite=$1 last; } ~~~ * Nginx版子目录(/so/): ~~~ if (!-e $request_filename) { rewrite /so/(.*) /so/index.php?rewrite=$1 last; } ~~~ * Apache版: ~~~ <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?rewrite=$1 </IfModule> ~~~ * Apache版子目录(请放到/so/文件夹下,注意不是根目录): ~~~ <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /so/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /so/index.php?rewrite=$1 </IfModule> ~~~ * IIS7/8版: ~~~xml <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <security> <requestFiltering allowDoubleEscaping="true"></requestFiltering> </security> <rewrite> <rules> <rule name="OrgPage" stopProcessing="true"> <match url="^(.*)$"/> <conditions logicalGrouping="MatchAll"> <add input="{HTTP_HOST}" pattern="^(.*)$"/> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/> </conditions> <action type="Rewrite" url="index.php?rewrite={R:1}"/> </rule> </rules> </rewrite> </system.webServer> </configuration> ~~~ * IIS7/8版子目录(/so/): ~~~xml <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <security> <requestFiltering allowDoubleEscaping="true"></requestFiltering> </security> <rewrite> <rules> <rule name="OrgPage" stopProcessing="true"> <match url="^so/(.*)$"/> <conditions logicalGrouping="MatchAll"> <add input="{HTTP_HOST}" pattern="^so/(.*)$"/> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/> </conditions> <action type="Rewrite" url="so/index.php?rewrite={R:1}"/> </rule> </rules> </rewrite> </system.webServer> </configuration> ~~~ * IIS版,IIS6.0下的httpd.ini: ~~~ [ISAPI_Rewrite] CacheClockRate 3600 RepeatLimit 32 RewriteRule ^/sitemap/$ /index\.php\?rewrite=sitemap/ RewriteRule ^/sitemap/(.*).html$ /index\.php\?rewrite=sitemap/$1.html RewriteRule ^/k/(.*)/(.*)$ /\?q=$1&p=$2 RewriteRule ^/k/(.*)$ /\?q=$1 ~~~ * IIS版,IIS6.0下的httpd.ini (/so/): ~~~ [ISAPI_Rewrite] CacheClockRate 3600 RepeatLimit 32 RewriteRule ^/so/sitemap/$ /so/index\.php\?rewrite=sitemap/ RewriteRule ^/so/sitemap/(.*).html$ /so/index\.php\?rewrite=sitemap/$1.html RewriteRule ^/so/k/(.*)/(.*)$ /so/\?q=$1&p=$2 RewriteRule ^/so/k/(.*)$ /so/\?q=$1 ~~~ ~~~ IIS6.0伪静态比较麻烦,后台修改URL格式,需要修改对应的规则,建议IIS6.0环境使用ISAPI_Rewrite3组件,这样就可以使用Apache的.htaccess规则了 ~~~