日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

解除轉(zhuǎn)換后的流量丟失之——全面Rewrite規(guī)則_PhpWind教程

編輯Tag賺U幣
教程Tag:暫無(wú)Tag,歡迎添加,賺取U幣!

 

之前寫過(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模板風(fēng)格

來(lái)源:Phpwind//所屬分類:PhpWind教程/更新時(shí)間:2009-11-24
相關(guān)PhpWind教程