.htaccess: 重寫規則工作一貫的子域和子目錄

有沒有辦法讓規則適用於子域和子目錄?

可參考下列範例自行修改
Options+FollowSymlinks-MultiViews
RewriteEngineOn
RewriteBase/blog
RewriteCond%{HTTP_HOST} blog\.example\.com [NC]
RewriteCond%{QUERY_STRING} !page_id= [NC]
RewriteRule^meetings /?page_id=2809 [L,NC]
RewriteCond%{HTTP_HOST} ^(www\.)?example\.com [NC]
RewriteCond%{QUERY_STRING} !page_id= [NC]
RewriteRule^meetings /blog/?page_id=2809 [L,NC]

永久重定向,取代[ L,R = 301與[ L ],NC,NC ]。

原文
http://codex.wiki/question/1407589-4747

 
  • 0 gebruikers vonden dit artikel nuttig
Was dit antwoord nuttig?

Gerelateerde artikelen

測試您的網站是否有惡意程式

Urlvoid.com 是  NoVirusThanks  這家公司發展的免費服務, 提供了20幾個偵測引擎來偵測網站的安全性,是否有惡意程式值入網站。網址:...

使用防火牆Phpwind 網站如何獲取用戶的真實IP?

使用WAF後,用戶訪問網站的是通過WAF服務器間接訪問網站服務器的,Phpwind論壇可能會在獲取用戶IP時,直接獲取WAF的IP,而不能直接獲取到用戶的真實IP,在此提出一些解決方案。...

How to Create a phpinfo File?

In the phpinfo.php page, the PHP version can be seen at the top of the file, listing the current...

VPS、實體主機的代管與非代管之意義為?

代管服務僅對於客戶主機使用cPanel 或 Plesk...

HTTP Status Codes ( 狀態碼 )

HTTP CODES - 100-101 100 - Continue ( 繼續 ) Tells the client that the first part of the...