IIS下如何?靜態化重寫?特別是像zen cart等php類型的網站應該是經常碰到。一下教程也是網上找到的,實驗下可以成功,這邊分享下。
第一:首先我們需要下載一個ISAPI_Rewrite,有精簡版和完全版,一般精簡版只能對伺服器全域進行配置,而完整版可以對伺服器上的各個網站進行偽靜態配置.對於個人站長來說,精簡版就足夠了.下載:http://www.isapirewrite.com/download/isapi_rwl_0055.msi
第二:下載完成後,可以找到安裝包裡的.msi的檔案,安裝即可.隨便裝在哪都可以,預設是裝在C:\Program Files\Helicon下,要注意的是這個目錄everyone要有讀取許可權。我就因為當時伺服器許可權配的比較嚴格,預設安裝Helicon這目錄EVERYONE是沒有任何許可權的,結果老是出現:Service Unavailable。
第三:開啟Internet資訊服務,右鍵,web網站屬性,點擊ISAPI篩選器選項卡.添加篩選器,這裡的名稱可以自己隨意填寫,路徑自己指定ISAPI_Rewrite.dll,然後確定。篩選器成功後會顯示一個綠色像上的箭頭。
最後在你安裝目錄下,預設C:\Program Files\Helicon\ISAPI_Rewrite 下編輯httpd.ini 這裡寫入你的重寫規則,注意該檔案預設為唯讀,所以編輯好後,最好設回唯讀,如果是zen cart的如下:
[ISAPI_Rewrite]# 3600 = 1 hour 設定緩衝時間 1個小時# Www.YOURDOMAIN.ComCacheClockRate 3600# 設定Regex 替換變數個數.RepeatLimit 32# www.YOURDOMAIN.comRewriteRule ^(.*)-p-(.*).html(\?)?(.*)? /index\.php\?main_page=product_info&products_id=$2&$4 [L]RewriteRule ^(.*)-c-(.*).html(\?)?(.*)? /index\.php\?main_page=index&cPath=$2&$4 [L]RewriteRule ^(.*)-m-([0-9]+).html(\?)?(.*)? /index\.php\?main_page=index&manufacturers_id=$2&$4 [L]RewriteRule ^(.*)-pi-([0-9]+).html(\?)?(.*)? /index\.php\?main_page=popup_image&pID=$2&$4 [L]RewriteRule ^(.*)-pr-([0-9]+).html(\?)?(.*)? /index\.php\?main_page=product_reviews&products_id=$2&$4 [L]RewriteRule ^(.*)-pri-([0-9]+).html(\?)?(.*)? /index\.php\?main_page=product_reviews_info&products_id=$2&$4 [L]# For Open Operations Info Manager# Www.YOURDOMAIN.ComRewriteRule ^(.*)-i-([0-9]+).html(\?)?(.*)? /index\.php\?main_page=info_manager&pages_id=$2&$4# For dreamscape”s News &Articles Manager# Www.YOURDOMAIN.ComRewriteRule ^news/?$ index\.php\?main_page=news&[L]RewriteRule ^news/rss.xml /index\.php\?main_page=news_rss&[L]RewriteRule ^news/archive/? /index\.php\?main_page=news_archive&[L]RewriteRule ^news/([0-9]{4})-([0-9]{2})-([0-9]{2}).html(\?)?(.*)? /index\.php\?main_page=news&date=$1-$2-$3&$5 [L]RewriteRule ^news/archive/([0-9]{4})-([0-9]{2}).html(\?)?(.*)? /index\.php\?main_page=news_archive&date=$1-$2&$4 [L]RewriteRule ^news/(.*)-a-([0-9]+)-comments.html(\?)?(.*)? /index\.php\?main_page=news_comments&article_id=$2&$4 [L]RewriteRule ^news/(.*)-a-([0-9]+).html(\?)?(.*)? /index\.php\?main_page=news_article&article_id=$2&$4 [L]# All other pages# Www.YOURDOMAIN.Com# Don”t rewrite real files or directoriesRewriteCond %{REQUEST_FILENAME} !-f [NC]RewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*).html(\?)?(.*)? /index\.php\?main_page=$1&$3 [L]# Www.YOURDOMAIN.Com說明及聲明:
前面說明過ISAPI_Rewrite有精簡版和完全版之分,前面的地址貌似是精簡版的,所以估計會對iis下的所有網站產生作用,使用的時候注意,網上有完整版的破解版,但是自己沒有使用過也不好說;這份Zen cart的重寫規則我並沒有自己動手驗證過,是朋友給我的,所以拷貝使用的時候明白下這點。
轉載請註明來自: http:www.ming-seo.org/?p=418
原創文章,轉載請註明: 轉載自網賺教程_網賺部落格_黑帽Seo_騷魚的部落格
本文連結地址: zencart iis 偽靜態設定 測試可用