在重写规则中使用或运算符 httpd.conf
Using or operator in rewrite rules httpd.conf
我正在使用以下重写规则:
RewriteRule ^true-stories/([0-9]+)/?$ read.php?ID= [NC,L]
RewriteRule ^short-stories/([0-9]+)/?$ read.php?ID= [NC,L]
RewriteRule ^serilaized-stories/([0-9]+)/?$ read.php?ID= [NC,L]
RewriteRule ^poems/([0-9]+)/?$ read.php?ID= [NC,L]
如您所见,它们都指向同一个文件。
有什么方法可以用一条规则应用所有规则吗?我在使用“|”时遇到了问题运算符。
您可以使用:
RewriteRule ^/?(?:(?:true|short|serilaized)-stories|poems)/([0-9]+)/?$ read.php?ID= [NC,L]
(?:)
= $n
中没有分组捕获
我正在使用以下重写规则:
RewriteRule ^true-stories/([0-9]+)/?$ read.php?ID= [NC,L]
RewriteRule ^short-stories/([0-9]+)/?$ read.php?ID= [NC,L]
RewriteRule ^serilaized-stories/([0-9]+)/?$ read.php?ID= [NC,L]
RewriteRule ^poems/([0-9]+)/?$ read.php?ID= [NC,L]
如您所见,它们都指向同一个文件。
有什么方法可以用一条规则应用所有规则吗?我在使用“|”时遇到了问题运算符。
您可以使用:
RewriteRule ^/?(?:(?:true|short|serilaized)-stories|poems)/([0-9]+)/?$ read.php?ID= [NC,L]
(?:)
= $n