偽靜態(tài)在iis下的規(guī)則和設(shè)置方法_Web服務(wù)器教程

      編輯Tag賺U幣

      最近陸續(xù)有很多站長(zhǎng)過(guò)來(lái)詢問(wèn)偽靜態(tài)的問(wèn)題,現(xiàn)就分享下目前網(wǎng)上流行的各種程序在iis下的規(guī)則和設(shè)置方法:

      shopex4.8
      下載3.0的免費(fèi)Rewrite組件 http://www.helicontech.com/download/isapi_rewrite/ISAPI_Rewrite3_0056_Lite.msi
      按照默認(rèn)路徑安裝后,打開(kāi)C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
      加入以下規(guī)則:
      # 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加載組件了:
      打開(kāi)iis,右鍵你的站點(diǎn)屬性--ISAPI 篩選器--添加--篩選器名稱是ISAPI_Rewrite3 --可執(zhí)行文件就是ISAPI_Rewrite.dll的路徑,比如C:\Program Files\Helicon\ISAPI_Rewrite3\ISAPI_Rewrite.dll
      最后重啟iis
      當(dāng)然你可以把ISAPI_Rewrite3目錄放入站點(diǎn)根目錄下,但記得要給一個(gè)users和"network  service"的讀權(quán)限。

      注意:有些服務(wù)器或者vps有做權(quán)限的,安裝后httpd.conf可能只有everyone和system的權(quán)限,如果修改不了文件就添加一個(gè)administrator的權(quán)限。


      shopex4.7
      免費(fèi)的rewrite2.0組件下載地址 http://www.isapirewrite.com/download/isapi_rwl_x86_0072.msi
      安裝后添加如下規(guī)則
      規(guī)則如下:
      [ISAPI_Rewrite]

      # 3600 = 1 hour
      CacheClockRate 3600

      RepeatLimit 32

      #首頁(yè)
      RewriteRule /index.html /index.php
      RewriteRule /default.html /index.php
      #商店公告
      RewriteRule /bulletin.html /index.php\?gOo=article_list.dwt&acat=1
      RewriteRule /bulletin_([0-9]+).html /index.php\?gOo=article_list.dwt&acat=1&p=$1
      #商品分類
      RewriteRule /catalog.html /index.php\?gOo=goods_category.dwt
      #全部商品
      RewriteRule /list.html /index.php\?gOo=goods_search_list.dwt
      RewriteRule /list_([0-9]+).html /index.php\?gOo=goods_search_list.dwt&p=$1
      #會(huì)員中心
      RewriteRule /member.html /index.php\?gOo=member_home.dwt
      #幫助中心與常見(jiàn)問(wèn)題
      RewriteRule /faq.html /index.php\?gOo=help.dwt&acat=2
      RewriteRule /faq_([0-9]+).html /index.php\?gOo=help.dwt&acat=2&p=$1
      #安全交易
      RewriteRule /safe.html /index.php\?gOo=help_safe.dwt
      #購(gòu)買(mǎi)流程
      RewriteRule /howtobuy.html /index.php\?gOo=help_buystep.dwt
      #如何付款
      RewriteRule /howtopay.html /index.php\?gOo=help_send.dwt
      #聯(lián)系我們
      RewriteRule /contactus.html /index.php\?gOo=help_contact.dwt
      #關(guān)于我們
      RewriteRule /aboutus.html /index.php\?gOo=help_copyright.dwt
      #顧客留言
      RewriteRule /feedback.html /index.php\?gOo=shopbbs.dwt
      #友情鏈接
      RewriteRule /friendlink.html /index.php\?gOo=linkmore.dwt
      #用戶注冊(cè)
      RewriteRule /register.html /index.php\?gOo=register_1.dwt
      #忘記密碼
      RewriteRule /lostpass.html /index.php\?gOo=forget.dwt
      #商品詳細(xì)頁(yè)
      RewriteRule /product/([0-9]+).html /index.php\?gOo=goods_details.dwt&goodsid=$1
      RewriteRule /product_([0-9]+).html /index.php\?gOo=goods_details.dwt&goodsid=$1
      RewriteRule /([0-9]+)_([^.]*).html /index.php\?gOo=goods_details.dwt&goodsid=$1
      #新聞詳細(xì)頁(yè)
      RewriteRule /article_([0-9]+).html /index.php\?gOo=help_details.dwt&articleid=$1
      RewriteRule /message_([0-9]+).html /index.php\?gOo=article_details.dwt&articleid=$1
      #分類詳細(xì)列表
      RewriteRule /catalog_([0-9]+).html /index.php\?gOo=goods_search_list.dwt&gcat=$1
      RewriteRule /catalog_([0-9]+)_([0-9]+).html /index.php\?gOo=goods_search_list.dwt&gcat=$1&p=$2
      #收藏商品
      RewriteRule /addtofavorites_([0-9]+).html /index.php\?gOo=addmembergoods.do&goodsid=$1
      #首頁(yè)上的最新,推薦,特價(jià)商品
      RewriteRule /list_([a-zA-Z]+).html /index.php\?gOo=goods_search_list.dwt&gtype=$1
      RewriteRule /list_([a-zA-Z]+)_([0-9]+).html /index.php\?gOo=goods_search_list.dwt&gtype=$1&p=$2


      下面就需要配置iis為shopex4.7加載組件了,方法類似shopex4.8:
      打開(kāi)iis,右鍵你的站點(diǎn)屬性--ISAPI 篩選器--添加--篩選器名稱是Rewrite --可執(zhí)行文件就是Rewrite.dll的路徑,比如E:\home\LocalUser\rewrite\Rewrite.dll
      最后重啟iis
      rewrite.dll以及規(guī)則可以放入任何一個(gè)目錄,但記得要給該目錄一個(gè)users的讀權(quán)限。

      以上就是shopex4.8和shopex4.7的規(guī)則以及配置方法。如果iis內(nèi)有其它程序比如discuz、phpwind之類的,就可能會(huì)相互有影響,那么就打開(kāi)iis,
      右鍵網(wǎng)站屬性--ISAPI 篩選器--刪除isapi_rewrite這項(xiàng),因?yàn)檫@里是對(duì)整個(gè)iis進(jìn)行設(shè)置的,會(huì)造成其它程序的沖突。
      注意isapi_rewrite3.0和isapi_rewrite2.0不能混用。


      因?yàn)槠鶈?wèn)題,現(xiàn)在再把shopex4.7/4.8、discuz6/NT2.5、ecshop、dvbbs、phpwind、wordpress、Discuz6+ecshop等偽靜態(tài)規(guī)則和組件打包進(jìn)行下載。


      以上設(shè)置都是針對(duì)租用了獨(dú)立服務(wù)器和vps的,在使用虛擬主機(jī)的就不用看了,因?yàn)樽鳛榉⻊?wù)商是應(yīng)該做好了的,但目前還沒(méi)有出現(xiàn)對(duì)所有流行程序都支持的吧。

      來(lái)源:網(wǎng)絡(luò)搜集//所屬分類:Web服務(wù)器教程/更新時(shí)間:2011-12-08
      相關(guān)Web服務(wù)器教程