I am pretty weak at regex, and I need help with a mod_rewrite rule that does the following:
Both directories a and b are under the same root directory of course.
I managed to do number 2, but I have no idea how to include rule 1.
You can use the following :
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]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.