學習Apache的mod rewrite、access寫法
更新時間:2008年09月13日 17:21:02 作者:
Apache的mod_rewrite是提供了強大URL操作的殺手級的模塊,可以實現(xiàn)幾乎所有你夢想的URL操作類型,其代價是你必須接受其復雜性,因為mod_rewrite的主要障礙就是初學者不容易理解和運用,即使是Apache專家有時也會發(fā)掘出mod_rewrite的新用途。
Apache 的 mod rewrite
RewriteEngine On RewriteBase /B2B/website/ RewriteRule ^article-([0-9]+)\.html$ view_details.php?browse=profile&id=$1
以上這個測試通過的。如果不行關鍵是服務器端,以后的怎么改就發(fā)揮了
關于圖片的 可以加一個 /503(id)/title.htm 這樣一定不重復了,用503或其他數(shù)字或者是abc也行,不顧oabc還想不是很理想,學學ii的,他就是用數(shù)字的定義所有的功能就行了
這個很有參考價值的
<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的
最強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
關鍵看看 %怎么用了 還有 [...]
RewriteEngine On RewriteBase /B2B/website/ RewriteRule ^article-([0-9]+)\.html$ view_details.php?browse=profile&id=$1
以上這個測試通過的。如果不行關鍵是服務器端,以后的怎么改就發(fā)揮了
關于圖片的 可以加一個 /503(id)/title.htm 這樣一定不重復了,用503或其他數(shù)字或者是abc也行,不顧oabc還想不是很理想,學學ii的,他就是用數(shù)字的定義所有的功能就行了
這個很有參考價值的
<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的
最強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
關鍵看看 %怎么用了 還有 [...]
您可能感興趣的文章:
- apache的rewrite規(guī)則使用說明
- 開啟Apache mod_rewrite模塊示例代碼
- 13個實用的Apache Rewrite重寫規(guī)則
- 淺談apache和nginx的rewrite的區(qū)別
- Apache Rewrite實現(xiàn)URL的301跳轉和域名跳轉
- Apache Rewrite url重定向功能的簡單配置
- 讓Apache支持Rewrite靜態(tài)頁面重寫的方法
- Linux下Apache安裝/增加mod_rewrite模塊的方法
- Apache rewrite的重寫相關的參數(shù)說明
- Apache rewrite重寫規(guī)則的常見應用
- apache rewrite_module模塊使用教程
- 用ISAPI_Rewrite讓IIS也支持如Apache下.htaccess的URL重寫
- apache rewrite規(guī)則實現(xiàn)白名單
相關文章
Centos7如何備份和還原Redis數(shù)據(jù)的方法
這篇文章主要介紹了Centos7如何備份和還原Redis數(shù)據(jù)的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-06-06解決Linux中Systemd服務環(huán)境變量缺失的問題
在Linux系統(tǒng)運維中,我們可能會遇到在使用systemd管理的服務時無法獲取系統(tǒng)環(huán)境變量,尤其是PATH變量,這確實是一個常見的挑戰(zhàn),因為systemd啟動的服務通常不會加載用戶的環(huán)境變量,下面,我們將一起探討解決這一問題的幾種方法,需要的朋友可以參考下2024-01-01LVS+Keepalived構建高可用負載均衡配置方法(配置篇)
這篇文章主要介紹了LVS+Keepalived構建高可用負載均衡配置方法,需要的朋友可以參考下2013-06-06