西部數(shù)碼所有型號(hào)虛擬主機(jī)均支持偽靜態(tài)Urlrewrite,支持自定義isapi功能(業(yè)界獨(dú)有),從而可以方便地支持任何系統(tǒng)的偽靜態(tài)功能,方便搜索引擎的收錄,詳見:
http://www.ps-sw.cn/services/webhosting/
如何使西部數(shù)碼linux虛擬主機(jī)支持靜態(tài)rewrite功能?
辦法是上傳.htaccess文件至wwwroot,然后在相關(guān)的系統(tǒng)里面開啟靜態(tài)化功能即可! .htaccess 文件的格式如下:
<IfModule mod_rewrite.c>
RewriteEngine On
# 修改以下語(yǔ)句中的 / 為你的論壇目錄地址,如果程序放在bbs中,請(qǐng)將 / 修改為 /bbs
RewriteBase /
#下面添加規(guī)則,不同的系統(tǒng)的規(guī)則各不相同。
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2
</IfModule>
以下給出當(dāng)前比較流行的phpwind,discuz,shopex三種系統(tǒng)的靜態(tài)化流程:
1.PHPWind論壇:
新建一個(gè)文本文件: new.htaccess 輸入以下文字:
<IfModule mod_rewrite.c>
RewriteEngine On
# 修改以下語(yǔ)句中的 / 為你的論壇目錄地址,如果程序放在bbs中,請(qǐng)將 / 修改為 /bbs
RewriteBase /
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2
</IfModule>
把這個(gè)文件上傳至虛擬主機(jī)的wwwroot目錄,并改名為:.htaccess, 改名后它會(huì)自動(dòng)隱藏不顯示出來(lái),但不影響使用!
上傳后請(qǐng)?jiān)谠谡搲芾砗笈_(tái)的靜態(tài)目錄部署把靜態(tài)目錄部署功能開啟 及把靜態(tài)目錄設(shè)置為-htm- ,靜態(tài)目錄擴(kuò)展名設(shè)置為.html
參考資料:
http://www.phpwind.net/read-htm-tid-164639.html
http://www.rzhz.cn/read.php?tid-581.html
2.discuz論壇
新建一個(gè)文本文件: new.htaccess 輸入以下文字:
<IfModule mod_rewrite.c>
# 將 RewriteEngine 模式打開
RewriteEngine On
RewriteBase /
# Rewrite 系統(tǒng)規(guī)則請(qǐng)勿修改
#discuz
RewriteRule ^(.*)/archiver/([a-z0-9\-]+\.html)$ $1/archiver/index\.php\?$2
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay\.php\?fid=$2&page=$3
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread\.php\?tid=$2&extra=page\%3D$4&page=$3
RewriteRule ^(.*)/profile-(username|uid)-(.+)\.html$ $1/viewpro\.php\?$2=$3
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2
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
</IfModule>
把這個(gè)文件上傳至虛擬主機(jī)的wwwroot目錄,并改名為:.htaccess。然后進(jìn)入論壇系統(tǒng)設(shè)置的搜索引擎優(yōu)化,根據(jù)需要開啟 URL 靜態(tài)化功能。
參考資料:http://www.discuz.net/usersguide/advanced_urlrewrite.htm
3.shopex網(wǎng)店 (適用于shopex4.8版)
新建一個(gè)文本文件:new.htaccess 輸入以下文字:
<IfModule mod_rewrite.c>
RewriteEngine on
#
RewriteBase /
RewriteRule ^themes/.*\.(html|xml)$ / [F]
RewriteCond %{REQUEST_FILENAME} \.(html|xml|json|htm|php|php2|php3|php4|php5|phtml|pwml|inc|asp|aspx|ascx|jsp|cfm|cfc|pl|cgi|shtml|shtm|phtm)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]
</IfModule>
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
把這個(gè)文件上傳至虛擬主機(jī)的wwwroot目錄,并改名為:.htaccess
上傳后請(qǐng)按以下方法到網(wǎng)站設(shè)置:進(jìn)入后臺(tái)-->系統(tǒng)設(shè)置-->商店設(shè)置-->基本設(shè)置-->URL重寫(選擇簡(jiǎn)單重寫)
5. SupeSite
新建一個(gè)文本文件: new.htaccess 輸入以下文字:
<IfModule mod_rewrite.c>
RewriteEngine On
# 修改以下語(yǔ)句中的 / 為你的論壇目錄地址,如果程序放在bbs中,請(qǐng)將 / 修改為 /bbs
RewriteBase /
RewriteRule ^(.*)/archiver/([a-z0-9\-]+\.html)$ $1/archiver/index\.php\?$2
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay\.php\?fid=$2&page=$3
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread\.php\?tid=$2&extra=page\%3D$4&page=$3
RewriteRule ^(.*)/profile-(username|uid)-(.+)\.html$ $1/viewpro\.php\?$2=$3
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2
</IfModule>
把這個(gè)文件上傳至虛擬主機(jī)的wwwroot目錄,并改名為:.htaccess
上傳后請(qǐng)按以下方法到網(wǎng)站設(shè)置:進(jìn)入后臺(tái)-->系統(tǒng)設(shè)置-->搜索優(yōu)化設(shè)置-->站點(diǎn)鏈接URL方式(選擇簡(jiǎn)單REWRITE模式(需要服務(wù)器REWRITE支持)),設(shè)置完后請(qǐng)注意更新緩存。
----------
相關(guān)介紹:
西部數(shù)碼windows虛擬主機(jī)如何做url靜態(tài)化(urlrewrite)?
以shopex4.8為例:
進(jìn)入虛擬主機(jī)控制面板,點(diǎn)“ISAPI篩選器 ”,進(jìn)入里面,SHOPEX和ECSHOP的靜態(tài)設(shè)置已經(jīng)給你設(shè)置好了,你直接點(diǎn)“開啟ShopEx4.8的URL靜態(tài)化支持”就行了,然后到shopex后臺(tái)設(shè)置
進(jìn)入管理后臺(tái)>商店推廣>搜索優(yōu)化>靜態(tài)優(yōu)先,選中“開啟靜態(tài)優(yōu)化 開啟Url Rewrite引擎 并在URL上針對(duì)搜索引擎進(jìn)行細(xì)致的優(yōu)化”,保存即可。
如果要關(guān)閉,請(qǐng)刪除isapi里面的shopex一項(xiàng)即可。
說(shuō)明:shopex的網(wǎng)頁(yè)必須放在網(wǎng)站根目錄才支持url靜態(tài)化
參考資料:http://www.shopex.cn/bbs/viewthread.php?tid=45957&highlight=%BE%B2%CC%AC