火端搜尋程式V2.1偽靜態規則
後臺偽靜態設定
火端搜尋程式2.1版偽靜態全新調整了,更簡單的規則,後臺隨時自定義偽靜態規則,不用再手動修改檔案。目錄格式還是.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。如下圖:
4、如果你的環境是IIS6.0
請複製程式裡偽靜態資料夾下的.htaccess檔案和httpd.ini到根目錄來,由於IIS6下偽靜態元件不一樣,不一定支援,建議不要使用Win2003+IIS6這種已經淘汰的環境了。
在後臺設定偽靜態規則的時候,建議使用“/”或者“_”這兩個字元來分割,不要用其它特殊字元,以免衝突出錯
2.X的程式裡已經包含了偽靜態規則
Nginx偽靜態規則
以下是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; }
請注意:如果設定偽靜態後搜尋中文亂碼,請在規則RewriteRule ^(.*)$ /index.php?rewrite=$1後面加上 [QSA,NU,PT,L]
Apache偽靜態規則
Apache版(.htaccess檔案)
RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?rewrite=$1
Apache版(放“so”子目錄)
RewriteEngine On RewriteBase /so/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /so/index.php?rewrite=$1
IIS版偽靜態規則
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版(放“so”子目錄)
Markup[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
IIS7/IIS7.5 web.config規則
Markup<?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>
如果是在so/目錄
Markup<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <defaultDocument> <files> <clear /> <add value="index.php" /> </files> </defaultDocument> <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>千行程式碼,Bug何處藏。 縱使上線又怎樣,朝令改,夕斷腸。