[英]mod_rewrite - rule according to url path
我在regex方面非常虛弱,我需要有關執行以下操作的mod_rewrite規則的幫助:
目錄a和b當然都在同一根目錄下。
我設法做到了2,但我不知道如何包括規則1。
您可以使用以下內容:
RewriteEngine on
#--if url is just the domain name--#
#--rewrite to /a/index.php--#
RewriteRule ^$ /a/index.php [NC,L]
#--if it contains path--#
#--rewrite to /b/index.php?id=path
RewriteRule ^((?!b).+)$ /b/index.php?id=$1 [NC,L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.