解除轉(zhuǎn)換后的流量丟失之——全面Rewrite規(guī)則_PhpWind教程
之前寫過(guò)一個(gè)PHPWind保持Dz轉(zhuǎn)換后的搜索引擎帶來(lái)的流量之rewrite 規(guī)則 ,當(dāng)時(shí)對(duì)此方面知識(shí)尚未深刻了解,局限性太強(qiáng),今天就全面的寫下轉(zhuǎn)換后的幾個(gè)rewriterule。
主要以這么5個(gè)Discuz!,DVBBS,LEOBBS,LEADBBS,BBSXP,,需要更多可以提出來(lái),我?guī)湍銓�,或者根�?jù)這個(gè)思路逐漸修改。
參考資料:http://httpd.apache.org/docs/2.2/rewrite/rewrite_guide.html 歡迎大家一起來(lái)~!~
我的平臺(tái)是 Apache/2.2.4 (Win32) ,IIS的偽靜態(tài)規(guī)則和apache可以通用, zeus和Nginx規(guī)則有些變化,但用的人比較少后面有時(shí)間再講
先針對(duì)的是有獨(dú)立主機(jī)權(quán)限的用戶請(qǐng)注意,高級(jí)重寫(要寫絕對(duì)目錄,這里舉例用/bbs/,請(qǐng)根據(jù)實(shí)際情況更改):
DZ轉(zhuǎn)換過(guò)來(lái)的�!居歇�(dú)立服務(wù)器的站長(zhǎng),重寫規(guī)則出錯(cuò)可以找官方俠客,或者找PM我一起解決】
請(qǐng)先做一下步驟:
把thread.php復(fù)制一份改名為forumdisplay.php
把read.php復(fù)制一份改名為viewthread.php
這樣省事省時(shí),保證動(dòng)態(tài)地址訪問(wèn)正常,接下去開(kāi)始偽靜態(tài)重寫規(guī)則
RewriteRule ^(.*)/archiver/$ [R]
用
# 適用于.htaccess和httpd.conf
RewriteEngine On
RewriteRule ^(.*)/archiver/ /simple/ [R]
RewriteRule ^(.*)/tid-(\d+)\.html /simple/index.php?t$2.html [R]
RewriteRule ^(.*)/fid-(\d+)\.html /simple/index.php?f$2.html [R]
RewriteRule ^(.*)/fid-(\d+)-(\d+)-1.html /simple/index.php?f$2.html [R]
RewriteRule ^(.*)/forum-(\d+)-(\d+)\.html$ $1/thread.php?fid=$2 [R]
RewriteRule ^(.*)/thread-(\d+)-(\d+)-(\d+)\.html$ $1/read.php?tid=$2 [R]
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)simple/([t|f].+).html$ /simple/index.php?$2.html [NC,L]
老版本如果不能實(shí)現(xiàn)偽靜態(tài),可以嘗試一下規(guī)則
# httpd.ini 在Rewrite的不同版本
RewriteRule ^(.*)-htm-(.*)$ $1\.php\?$2
RewriteRule ^(.*)simple/([t|f].+).html$ /simple/index.php?$2.html [NC]
然后重啟IIS或者apache.
或者用下面
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} ^/bbs/forumdisplay.php$ [OR]
RewriteCond %{SCRIPT_FILENAME} ^/bbs/viewthread.php$ [NC]
RewriteCond %{QUERY_STRING} fid=(\d+) [OR]
RewriteCond %{QUERY_STRING} tid=(\d+) [NC]
RewriteRule (.*) /%{QUERY_STRING} [NC]
RewriteRule ^/fid=(\d+) /bbs/thread.php?fid=$1 [R]
RewriteRule ^/tid=(\d+) /bbs/read.php?tid=$1 [R]
RewriteCond %{SCRIPT_FILENAME} ^/bbs/archiver/$ [NC]
RewriteCond %{QUERY_STRING} tid-(\d+).html [OR]
RewriteCond %{QUERY_STRING} fid-(\d+).html [NC]
RewriteRule (.*) /%{QUERY_STRING} [NC]
RewriteRule ^/tid-(\d+).html /bbs/simple/index.php?t$1.html [R]
RewriteRule ^/fid-(\d+).html /bbs/simple/index.php?f$1.html [R]
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/thread.php?fid=$2
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/read.php?tid=$2
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)simple/([t|f].+).html$ /simple/index.php?$2.html [NC,L]
ZUes的偽靜態(tài)
match URL into ^(.*)/forum-([0-9]+)-([0-9]+)\.html$
if matched then
set URL = $1/thread.php?fid=$2
endif
match URL into $ with ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$
if matched then
set URL = $1/read.php?tid=$2
endif
match URL into $ with ^(.*)-htm-(.*)$
if matched then
set URL = $1.php?$2
endif
match URL into $ with ^(.*)/simple/([a-z0-9\_]+\.html)$
if matched then
set URL = $1/simple/index.php?$2
endif
DVBBS轉(zhuǎn)換過(guò)來(lái)的
1\IIS的httpd.ini
[ISAPI_Rewrite]
RewriteEngine On
CacheClockRate 3600
RepeatLimit 32
RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]
RewriteRule ^(.*)/dispbbs.asp\?boardid=(\d+)&Id=(\d+) $1/read.php?tid=$3 [NC]
RewriteRule ^(.*)/dispbbs.asp\?boardid=(\d+)&id=(\d+) $1/read.php?tid=$3 [R]
RewriteRule ^(.*)/dispbbs.asp\?BoardID=(\d+)&Id=(\d+) $1/read.php?tid=$3 [R]
RewriteRule ^(.*)/index.asp\?boardid=(\d+) $1/thread.php?fid=$2 [R]
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)simple/([t|f].+).html$ /simple/index.php?$2.html [NC,L]
#Code By Josh @ PHPWind 2008-09-25 ?([a-zA-Z]+)
2、apache
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} ^/bbs/index.asp$ [NC]
RewriteCond %{QUERY_STRING} boardid=(\d+)$ [NC]
RewriteRule (.*) /%{QUERY_STRING} [NC]
RewriteRule ^/boardid=(\d+)$ /bbs/thread.php?fid=$1 [R]
RewriteCond %{SCRIPT_FILENAME} ^/bbs/dispbbs.asp$ [NC]
RewriteCond %{QUERY_STRING} boardid=(\d+)&Id=(\d+) [NC]
RewriteRule (.*) /%{QUERY_STRING} [NC]
RewriteRule ^/boardid=(\d+)&Id=(\d+) /bbs/read.php?tid=$2 [R]
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)simple/([t|f].+).html$ /simple/index.php?$2.html [NC,L]
LEOBBS轉(zhuǎn)換過(guò)來(lái)的
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} ^/bbs/cgi-bin/forums.cgi$ [NC]
RewriteCond %{QUERY_STRING} forum=(\d+)$ [NC]
RewriteRule (.*) /%{QUERY_STRING} [NC]
RewriteRule ^/forum=(\d+)$ /bbs/thread.php?fid=$1 [R]
RewriteCond %{SCRIPT_FILENAME} ^/bbs/cgi-bin/topic.cgi$ [NC]
RewriteCond %{QUERY_STRING} forum=(\d+)&topic=(\d+) [NC]
RewriteRule (.*) /%{QUERY_STRING} [NC]
RewriteRule ^/forum=(\d+)&topic=(\d+) /bbs/read.php?tid=$2 [R]
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)simple/([t|f].+).html$ /simple/index.php?$2.html [NC,L]
BBSXP轉(zhuǎn)換過(guò)來(lái)的
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} ^/bbs/ShowForum.asp$ [NC]
RewriteCond %{QUERY_STRING} ForumID=(\d+) [NC]
RewriteRule (.*) /%{QUERY_STRING} [NC]
RewriteRule ^/ForumID=(\d+) /bbs/thread.php?fid=$1 [R]
RewriteCond %{SCRIPT_FILENAME} ^/bbs/ShowPost.asp$ [NC]
RewriteCond %{QUERY_STRING} ThreadID=(\d+) [NC]
RewriteRule (.*) /%{QUERY_STRING} [NC]
RewriteRule ^/ThreadID=(\d+) /bbs/read.php?tid=$1 [R]
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)simple/([t|f].+).html$ /simple/index.php?$2.html [NC,L]
LEADBBS轉(zhuǎn)換過(guò)來(lái)的
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} ^/bbs/b/b.asp$ [NC]
RewriteCond %{QUERY_STRING} B=(\d+) [NC]
RewriteRule (.*) /%{QUERY_STRING} [NC]
RewriteRule ^/B=(\d+) /bbs/thread.php?fid=$1 [R]
RewriteCond %{SCRIPT_FILENAME} ^/bbs/a.asp$ [NC]
RewriteCond %{QUERY_STRING} B=(\d+)&ID=(\d+) [NC]
RewriteRule (.*) /%{QUERY_STRING} [NC]
RewriteRule ^/B=(\d+)&ID=(\d+) /bbs/read.php?tid=$2 [R]
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)simple/([t|f].+).html$ /simple/index.php?$2.html [NC,L]
無(wú)獨(dú)立服務(wù)器權(quán)限的做法:
分兩種情況,一是支持.htaccess,一種是不支持偽靜態(tài)的虛擬空間。
對(duì)于支持.htaccess的空間,可以套用轉(zhuǎn)發(fā)規(guī)則進(jìn)行處理.
無(wú)法用重寫的,我們用文件來(lái)補(bǔ)救
DZ:
把thread.php復(fù)制一份改名為forumdisplay.php
把read.php復(fù)制一份改名為viewthread.php
這樣省事省時(shí),哈哈,祝大家愉快!
DVBBS:
如果你的服務(wù)器還支持ASP的話
可以在index.asp和dispbbs.asp上面做下。
- PhpWind教程:PHPWind forum V7.5 SP1 使用與修復(fù)說(shuō)明
- PhpWind教程:PHPWind Forum V7.5 升級(jí)教程
- PHPWind7.3 升級(jí)7.3.2 圖文教程
- PhpWind教程:sitemap生成問(wèn)題
- PhpWind教程:熱榜排行 for 75
- PHPwind 6.3.2升級(jí)至PHPwind 7.3.2 圖文教程
- PHPWind 7.0 升級(jí)至PHPwind 7.3.2 圖文教程
- PHPWind 7.0 升級(jí)到PHPwind v7.3 圖文教程
- PHPWind 6.3.2升級(jí)到 PHPwind v7.3 圖文教程
- PHPWind6.3.2升級(jí)PHPWind7.0說(shuō)明教程
- PhpWind教程:PHPWind6.3(6.3rc、6.3) to PHPWind6.3.2升級(jí)教程
- PhpWind教程:PHPWind6.x(6.0rc、6.0) to PHPWind6.3.2升級(jí)教程
PhpWind教程教程Rss訂閱Cms教程搜索
PhpWind教程推薦
- PhpWind教程:PHPWind V7.5 圖標(biāo)規(guī)范及使用說(shuō)明
- PhpWind教程:Windows環(huán)境下PHP5開(kāi)發(fā)配置指南
- PhpWind教程:貢獻(xiàn)值在個(gè)人信息的顯示
- PhpWind教程:首頁(yè)熱榜或者10格等圖片出不來(lái)
- PhpWind教程:廣告位添加教程 for 75
- PhpWind教程:修改首頁(yè)版塊間距
- PhpWind教程:PHPWind forum V7.5 插件教程
- PhpWind教程:增強(qiáng)網(wǎng)站安全性,data目錄隱藏功能設(shè)置詳解
- PhpWind教程:論壇后臺(tái)圖片、提交按紐等無(wú)法顯示的問(wèn)題
- PHPWind轉(zhuǎn)換教程:Discuz!NT 2.5 ACCESS版 轉(zhuǎn)換至 phpwind 7.3.2
- 相關(guān)鏈接:
- 教程說(shuō)明:
PhpWind教程-解除轉(zhuǎn)換后的流量丟失之——全面Rewrite規(guī)則
。