[英]Using or operator in rewrite rules httpd.conf
我正在使用以下重寫規則:
RewriteRule ^true-stories/([0-9]+)/?$ read.php?ID=$1 [NC,L]
RewriteRule ^short-stories/([0-9]+)/?$ read.php?ID=$1 [NC,L]
RewriteRule ^serilaized-stories/([0-9]+)/?$ read.php?ID=$1 [NC,L]
RewriteRule ^poems/([0-9]+)/?$ read.php?ID=$1 [NC,L]
如您所見,它們都指向同一文件。
有什么方法可以將所有規則與一個規則一起應用嗎? 我在使用“ |”時遇到問題 操作員。
您可以使用:
RewriteRule ^/?(?:(?:true|short|serilaized)-stories|poems)/([0-9]+)/?$ read.php?ID=$1 [NC,L]
(?:)
=不對$ n中的捕獲進行分組
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.