學(xué)習(xí)Apache的mod rewrite、access寫法
更新時(shí)間:2008年09月13日 17:21:02 作者:
Apache的mod_rewrite是提供了強(qiáng)大URL操作的殺手級(jí)的模塊,可以實(shí)現(xiàn)幾乎所有你夢(mèng)想的URL操作類型,其代價(jià)是你必須接受其復(fù)雜性,因?yàn)閙od_rewrite的主要障礙就是初學(xué)者不容易理解和運(yùn)用,即使是Apache專家有時(shí)也會(huì)發(fā)掘出mod_rewrite的新用途。
Apache 的 mod rewrite
RewriteEngine On RewriteBase /B2B/website/ RewriteRule ^article-([0-9]+)\.html$ view_details.php?browse=profile&id=$1
以上這個(gè)測(cè)試通過的。如果不行關(guān)鍵是服務(wù)器端,以后的怎么改就發(fā)揮了
關(guān)于圖片的 可以加一個(gè) /503(id)/title.htm 這樣一定不重復(fù)了,用503或其他數(shù)字或者是abc也行,不顧oabc還想不是很理想,學(xué)學(xué)ii的,他就是用數(shù)字的定義所有的功能就行了
這個(gè)很有參考價(jià)值的
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)/archiver/((fid|tid)-[\w\-]+\.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 ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3
RewriteRule ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2
</IfModule>
discuz的
最強(qiáng)wordpress的
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
關(guān)鍵看看 %怎么用了 還有 [...]
RewriteEngine On RewriteBase /B2B/website/ RewriteRule ^article-([0-9]+)\.html$ view_details.php?browse=profile&id=$1
以上這個(gè)測(cè)試通過的。如果不行關(guān)鍵是服務(wù)器端,以后的怎么改就發(fā)揮了
關(guān)于圖片的 可以加一個(gè) /503(id)/title.htm 這樣一定不重復(fù)了,用503或其他數(shù)字或者是abc也行,不顧oabc還想不是很理想,學(xué)學(xué)ii的,他就是用數(shù)字的定義所有的功能就行了
這個(gè)很有參考價(jià)值的
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)/archiver/((fid|tid)-[\w\-]+\.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 ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3
RewriteRule ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2
</IfModule>
discuz的
最強(qiáng)wordpress的
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
關(guān)鍵看看 %怎么用了 還有 [...]
您可能感興趣的文章:
- apache的rewrite規(guī)則使用說明
- 開啟Apache mod_rewrite模塊示例代碼
- 13個(gè)實(shí)用的Apache Rewrite重寫規(guī)則
- 淺談apache和nginx的rewrite的區(qū)別
- Apache Rewrite實(shí)現(xiàn)URL的301跳轉(zhuǎn)和域名跳轉(zhuǎn)
- Apache Rewrite url重定向功能的簡(jiǎn)單配置
- 讓Apache支持Rewrite靜態(tài)頁(yè)面重寫的方法
- Linux下Apache安裝/增加mod_rewrite模塊的方法
- Apache rewrite的重寫相關(guān)的參數(shù)說明
- Apache rewrite重寫規(guī)則的常見應(yīng)用
- apache rewrite_module模塊使用教程
- 用ISAPI_Rewrite讓IIS也支持如Apache下.htaccess的URL重寫
- apache rewrite規(guī)則實(shí)現(xiàn)白名單
相關(guān)文章
centos redhat系列對(duì)抗ddos之居家必備利器 banip.txt
本文可以用于redhat centos 系列 linux 系統(tǒng)的 屏蔽多連接ip,具有抗ddos功能的代碼。2010-11-11
關(guān)于linux下core dump【總結(jié)】
下面小編就為大家?guī)硪黄P(guān)于linux下core dump【總結(jié)】。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-01-01
關(guān)于Linux操作系統(tǒng)下終端亂碼的完美解決方法
下面小編就為大家?guī)硪黄P(guān)于Linux操作系統(tǒng)下終端亂碼的完美解決方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-10-10
Linux下用dnsmasq做dns cache server的配置方法
最近國(guó)外的服務(wù)器本地DNS總是出故障,閃斷一會(huì)兒都會(huì)影響業(yè)務(wù)。于是在機(jī)房里找了兩臺(tái)Server,安裝上keepalived和dnsmasq實(shí)際本地的DNS緩存2014-08-08
linux如何mount掛載磁盤并設(shè)置開機(jī)自動(dòng)mount的實(shí)現(xiàn)
這篇文章主要介紹了linux如何mount掛載磁盤并設(shè)置開機(jī)自動(dòng)mount的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-09-09
如何在Linux中route?add命令添加路由(Linux?route)
route?add命令是用于管理Linux操作系統(tǒng)網(wǎng)絡(luò)路由,允許用戶添加、刪除或修改網(wǎng)絡(luò)路由表中的條目,在Linux系統(tǒng)上添加靜態(tài)路由,靜態(tài)路由是手動(dòng)配置的路由,它指定了數(shù)據(jù)包從一個(gè)網(wǎng)絡(luò)到達(dá)另一個(gè)網(wǎng)絡(luò)的路徑,通過添加靜態(tài)路由,可實(shí)現(xiàn)網(wǎng)絡(luò)分段、轉(zhuǎn)發(fā)和通信等2024-06-06

