仲介交易 HTTP://www.aliyun.com/zixun/aggregation/6858.html">SEO診斷 淘寶客 雲主機 技術大廳
最近陸續有很多站長過來詢問偽靜態的問題,現就分享下目前網上流行的各種程式在iis下的規則和設置方法:
1、shopex4.8
下載3.0的免費Rewrite元件 HTTP://www.helicontech.com/download/isapi_rewrite/ISAPI_Rewrite3_0056_Lite.msi
按照預設路徑安裝後,打開C:\Program Files\Helicon\ISAPI_Rewrite3\HTTPd.conf
加入以下規則:
# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.56
RewriteBase /
RewriteCond %{REQUEST_FILENAME} \. (html|htm|php|php2|php3|php4|php5|phtml|pwml|inc|asp|aspx|ascx|jsp|cfm|cfc|pl|cgi|shtml|shtm|phtm|xml)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect HTTPd.ini and HTTPd.parse.errors files
# from accessing through HTTP
RewriteRule ^(.*)/archiver/((fid|tid)-[0-9]+\.html)\?*(.*)$ $1/archiver/index\.php\?$2&$4
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/forumdisplay\.php\?fid=$2&page=$3&$4
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/viewthread\.php\?tid=$2&extra=page\%3D$ 4&page=$3&$4
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html\?*(.*)$ $1/space\.php\?$2=$3&$4
RewriteRule ^(.*)/tag-(.+)\.html\?*(.*)$ $1/tag\.php\?name=$2&$3
下面就需要配置iis為shopex4.8載入元件了:
打開iis,右鍵你的網站屬性--ISAPI 篩選器--添加--篩選器名稱是ISAPI_Rewrite3 --可執行檔就是ISAPI_Rewrite.dll的路徑,比如C:\Program Files\Helicon\ ISAPI_Rewrite3\ISAPI_Rewrite.dll
最後重啟iis
當然你可以把ISAPI_Rewrite3目錄放入網站根目錄下,但記得要給一個users讀許可權。 如果都設置了還不行,可為網站跟目錄加一個「network service」的讀許可權。
注意:有些伺服器或者vps有做許可權的,安裝後HTTPd.conf可能只有everyone和system的許可權,如果修改不了檔就添加一個administrator的許可權。
2、Discuz6+ecshop
規則如下:
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect HTTPd.ini and HTTPd.parse.errors files
# from accessing through HTTP
RewriteCond %{HTTP_HOST}
RewriteRule /index.html /index.php [I]
RewriteRule /default.html /index.php [I]
RewriteRule /feed.xml /feed.php [I]
RewriteRule /category-([0-9]+).html /category\.php\?id=$1 [I]
RewriteRule /category-([0-9]+)-([0-9]+).html /category\.php\?id=$1&page=$2 [I]
RewriteRule /category-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+).html /category\.php\?id=$1&page=$2&sort=$3& order=$4 [I]
RewriteRule /goods-([0-9]+)\.html /goods\.php\?id=$1 [I]
RewriteRule /article_cat-([0-9]+).html /article_cat\.php\?id=$1 [I]
RewriteRule /article_cat-([0-9]+)-([0-9]+).html /article_cat\.php\?id=$1&page=$2 [I]
RewriteRule /article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+).html /article_cat\.php\?id=$1&page=$2&sort=$ 3&order=$4 [I]
RewriteRule /article-([0-9]+).html /article\.php\?id=$1 [I]
RewriteRule /search-b([0-9]+) /search\.php\?brand=$1 [I]
RewriteRule /search-([0-9]+)-([^-]*)-([a-zA-Z]+)-k(.*).html /search\.php\?page=$1&sort=$2&order=$3& keywords=$4 [I]
RewriteRule /search-([0-9]+)-([^-]*)-([a-zA-Z]+)-b([0-9]*)-k(.*)-s([0-9]*)-l([0-9]*).html /search\.php\?page=$1 &sort=$2&order=$3&brand=$4&keywords=$5&min_price=$6&max_price=$7 [I]
#discuz
RewriteRule ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)\?*(.*)$ $1/archiver/index\.php\?$2&$4
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/forumdisplay\.php\?fid=$2&page=$3&$4
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/viewthread\.php\?tid=$2&extra=page\%3D$ 4&page=$3&$4
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html\?*(.*)$ $1/space\.php\?$2=$3&$4
RewriteRule ^(.*)/tag-(.+)\.html\?*(.*)$ $1/tag\.php\?name=$2&$3
然後配置iis載入元件,方法類似shopex4.8:
打開iis,右鍵你的網站屬性--ISAPI 篩選器--添加--篩選器名稱是Rewrite --可執行檔就是Rewrite.dll的路徑,比如E:\home\LocalUser\rewrite\Rewrite.dll
最後重啟iis
3、discuz
規則如下:
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect HTTPd.ini and HTTPd.parse.errors files
# from accessing through HTTP
RewriteRule ^(.*)/archiver/([a-z0-9\-]+\.html)\?*(.*)$ $1/archiver/index\.php\?$2&$3
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/forumdisplay\.php\?fid=$2&page=$3&$4
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/viewthread\.php\?tid=$2&extra=page\%3D$ 4&page=$3&$4
RewriteRule ^(.*)/profile-(username|uid)-(.+)\.html\?*(.*)$ $1/viewpro\.php\?$2=$3&$4
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html\?*(.*)$ $1/space\.php\?$2=$3&$4
打開iis,右鍵你的網站屬性--ISAPI 篩選器--添加--篩選器名稱是Rewrite --可執行檔就是Rewrite.dll的路徑,比如E:\home\LocalUser\rewrite\Rewrite.dll
最後重啟iis
4、ecshop
規則如下:
[ISAPI_Rewrite]
# ECSHOP
RewriteRule /index.html /index.php [I]
RewriteRule /default.html /index.php [I]
RewriteRule /ecshop/feed.xml /ecshop/feed.php [I]
#RewriteRule /ecshop/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ /ecshop/category.php?id=$1 &brand=$2&page=$3&sort=$4&order=$5 [I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/category\.php\?id=$2& brand=$3&page=$4&sort=$5&order=$6 [I]
#RewriteRule /ecshop/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$ /ecshop/category.php?id=$1&brand=$2 &page=$3 [I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$ $1/category\.php\?id=$2&brand=$3&page= $4 [I]
#RewriteRule /ecshop/category-([0-9]+)-b([0-9]+)(.*)\.html$ /ecshop/category.php?id=$1&brand=$2 [I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)(.*)\.html$ $1/category\.php\?id=$2&brand=$3 [I]
#RewriteRule /ecshop/category-([0-9]+)(.*)\.html$ /ecshop/category.php?id=$1 [I]
RewriteRule ^(.*)/category-([0-9]+)(.*)\.html$ $1/category\.php\?id=$2 [I]
#RewriteRule /ecshop/goods-([0-9]+)(.*)\.html$ /ecshop/goods.php?id=$1 [I]
RewriteRule ^(.*)/goods-([0-9]+)(.*)\.html$ $1/goods\.php\?id=$2
#RewriteRule /ecshop/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ /ecshop/article_cat.php?id=$1 &page=$2&sort=$3&order=$4 [I]
RewriteRule ^(.*)/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/article_cat\.php\?id=$2&page= $3&sort=$4&order=$5 [I]
#RewriteRule /ecshop/article_cat-([0-9]+)-([0-9]+)(.*)\.html$ /ecshop/article_cat.php?id=$1&page=$2 [I]
RewriteRule ^(.*)/article_cat-([0-9]+)-([0-9]+)(.*)\.html$ $1/article_cat\.php\?id=$2&page=$3 [I]
#RewriteRule /ecshop/article_cat-([0-9]+)(.*)\.html$ /ecshop/article_cat.php?id=$1 [I]
RewriteRule ^(.*)/article_cat-([0-9]+)(.*)\.html$ $1/article_cat\.php\?id=$2 [I]
#RewriteRule /ecshop/article-([0-9]+)(.*)\.html$ /ecshop/article.php?id=$1 [I]
RewriteRule ^(.*)/article-([0-9]+)(.*)\.html$ $1/article\.php\?id=$2 [I]
#RewriteRule /ecshop/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html /ecshop/brand.php?id=$1&cat=$2 &page=$3&sort=$4&order=$5 [I]
RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html $1/brand\.php\?id=$2&cat=$3 &page=$4&sort=$5&order=$6 [I]
#RewriteRule /ecshop/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html /ecshop/brand.php?id=$1&cat=$2&page=$3 [ I]
RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html $1/brand\.php\?id=$2&cat=$3&page=$4 [I]
#RewriteRule /ecshop/brand-([0-9]+)-c([0-9]+)(.*)\.html /ecshop/brand.php?id=$1&cat=$2 [I]
RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)(.*)\.html $1/brand\.php\?id=$2&cat=$3 [I]
#RewriteRule /ecshop/brand-([0-9]+)(.*)\.html /ecshop/brand.php?id=$1 [I]
RewriteRule ^(.*)/brand-([0-9]+)(.*)\.html $1/brand\.php\?id=$2 [I]
#RewriteRule /ecshop/tag-(.*)\.html /ecshop/search.php?keywords=$1 [I]
RewriteRule ^(.*)/tag-(.*)\.html $1/search\.php\?keywords=$2 [I]
5、dvbbs
規則如下:
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Block external access to the HTTPd.ini and HTTPd.parse.errors files
RewriteRule /HTTPd(?:\. ini|\.parse\.errors).* / [F,I,O]
# Block external access to the Helper ISAPI Extension
RewriteRule .*\.isrwhlp / [F,I,O]
# 重寫index.asp
RewriteRule /(你的論壇所在目錄,以根目錄起)/index_(\d+)_(.*)_(\d+)_(\d+)\.html /(你的論壇所在目錄,以根目錄起)/index\.asp\?boardid=$1& action=$2&topicmode=$3&page=$4 [N,I]
RewriteRule /(你的論壇所在目錄,以根目錄起)/index_(\d+)_(\d+)_(.*)\.html /(你的論壇所在目錄,以根目錄起)/index\.asp\?boardid=$1&page=$2 &action=$3 [N,I]
RewriteRule /(你的論壇所在目錄,以根目錄起)/index_(\d+)_(\d+)\.html /(你的論壇所在目錄,以根目錄起)/index\.asp\?boardid=$1&topicmode=$2 [ N,I]
RewriteRule /(你的論壇所在目錄,以根目錄起)/index_(\d+)_(\d+)_\.html /(你的論壇所在目錄,以根目錄起)/index\.asp\?boardid=$1&page=$2 [N,I]
RewriteRule /(你的論壇所在目錄,以根目錄起)/index_(\d+)__\.html /(你的論壇所在目錄,以根目錄起)/index\.asp\?boardid=$1 [N,I]
RewriteRule /(你的論壇所在目錄,以根目錄起)/index_(\d+)\.html /(你的論壇所在目錄,以根目錄起)/index\.asp\?boardid=$1 [N,I]
RewriteRule /(你的論壇所在目錄,以根目錄起)/index\.html(.*) /(你的論壇所在目錄,以根目錄起)/index.asp [N,I]
# 重寫dispbbs.asp
RewriteRule /(你的論壇所在目錄,以根目錄起)/dispbbs_(\d+)_(\d+)_(\d+)_skin(\d+)_(\d+)_(\d+)\.html /(你的論壇所在目錄,以根目錄起)/dispbbs\. asp\?boardid=$1&replyid=$2&id=$3&skin=$4&page=$5&star=$6 [N,I]
RewriteRule /(你的論壇所在目錄,以根目錄起)/dispbbs_(\d+)_(\d+)_(\d+)_skin(\d+)_(\d+)\.html /(你的論壇所在目錄,以根目錄起)/dispbbs\.asp\? boardid=$1&replyid=$2&id=$3&skin=$4&star=$5 [N,I]
RewriteRule /(你的論壇所在目錄,以根目錄起)/dispbbs_(\d+)_(\d+)_(\d+)_skin(\d+)\.html /(你的論壇所在目錄,以根目錄起)/dispbbs.asp\?boardID=$ 1&replyid=$2&ID=$3&skin=$4 [N,I]
RewriteRule /(你的論壇所在目錄,以根目錄起)/dispbbs_(\d+)_(\d+)_(\d+)\.html /(你的論壇所在目錄,以根目錄起)/dispbbs.asp\?boardID=$1&ID=$ 2&page=$3 [N,I]
RewriteRule /(你的論壇所在目錄,以根目錄起)/dispbbs_(\d+)_(\d+)_(\d+)_(\d+)\.html /(你的論壇所在目錄,以根目錄起)/dispbbs.asp\?boardID=$1 &ID=$2&star=$3&page=$4 [N,I]
# 重寫dv_rss.asp
RewriteRule /(你的論壇所在目錄,以根目錄起)/dv_rss_(.*)_(\d+)_(\d+)_(\d+)_(\d+)_count(\d+)\.html /(你的論壇所在目錄,以根目錄起)/dv_rss.asp\ ?s=$1&boardid=$2&id=$3&page=$4&star=$5&count=$6 [N,I]
RewriteRule /(你的論壇所在目錄,以根目錄起)/dv_rss_(.*)_(\d+)_(\d+)_(\d+)_(\d+)\.html /(你的論壇所在目錄,以根目錄起)/dv_rss.asp\?s=$1& boardid=$2&id=$3&page=$4&star=$5 [N,I]
RewriteRule /(你的論壇所在目錄,以根目錄起)/dv_rss_(.*)_(\d+)_(\d+)_(\d+)\.html /(你的論壇所在目錄,以根目錄起)/dv_rss.asp\?s=$1&boardid =$2&id=$3&page=$4 [N,I]
RewriteRule /(你的論壇所在目錄,以根目錄起)/dv_rss_(.*)_(\d+)_(\d+)_count(\d+)\.html /(你的論壇所在目錄,以根目錄起)/dv_rss.asp\?s=$1& boardid=$2&page=$3&count=$4 [N,I]
RewriteRule /(你的論壇所在目錄,以根目錄起)/dv_rss_(.*)_(\d+)_(\d+)\.html /(你的論壇所在目錄,以根目錄起)/dv_rss.asp\?s=$1&boardid=$2 &page=S3 [N,I]
RewriteRule /(你的論壇所在目錄,以根目錄起)/dv_rss_(.*)_(\d+)\.html /(你的論壇所在目錄,以根目錄起)/dv_rss.asp\?s=$1&boardid=$2 [N,I]
RewriteRule /(你的論壇所在目錄,以根目錄起)/dv_rss_(.*)\.html /(你的論壇所在目錄,以根目錄起)/dv_rss.asp\?s=$1 [N,I]
RewriteRule /(你的論壇所在目錄,以根目錄起)/dv_rss(.*)\.html(.*) /(你的論壇所在目錄,以根目錄起)/dv_rss.asp [N,I]
注意:
1、isapi_rewrite3.0和isapi_rewrite2.0不可隨意混用。 並不建議採用安裝元件的方式,直接使用dll元件和規則就可以了。
2、rewrite.dll以及規則可以放入任何一個目錄,但記得要給該目錄一個users的讀許可權。
3、shopex4.8和其它程式有點不同,shopex4.8只能使用最新的rewirte3.0,老版本的不支援RewriteCond語法。
4、如果是用的安裝元件的方式,可能會對其它程式比如discuz、phpwind之類的有影響,那麼就打開iis,
右鍵網站屬性--ISAPI 篩選器--刪除isapi_rewrite這項,因為這裡是對整個iis進行全域設置的,會造成其它程式的衝突
5、因為shopex4.8目前很流行但又採用了不同的規則方式,所以規則最好別和其它程式在一起使用,而且是要為使用4.8的網站進行單獨的isapi篩選設置,shopex也必須安裝在根目錄才可以,因為RewriteBase / 指定了在根目錄,無法為每個客戶單獨配置這個檔。
以上只是給出了最常用的shopex4.8和discuz6以及discuz+ecshop的規則以及配置方法,其它幾種都大同小異了,主要是規則的不同,也都將做打包。
因為篇幅和限制原因,已經把shopex4.7/4.8、discuz6/NT2.5、ecshop、dvbbs、phpwind、wordpress、Discuz6+ecshop等偽靜態規則和元件打包, 如有需要可到我公司官方網站進行查詢下載。
以上設置都是針對租用了獨立伺服器和vps的,在使用虛擬主機的就不用看了,因為作為服務商是應該做好了的,但目前還沒有出現對所有流行程式都支援的吧。 華夏名網已經在最新的管理系統內對所有型號主機集成了偽靜態支援。 如有不明白的也可隨時來諮詢並提供免費預裝。