[英]How to merge these url rewrite rules together?
我在.htaccess文件中使用這3條規則來重寫url,它們工作良好。 但我認為這3條規則可以合並為1條規則。 有人可以告訴我該怎么做嗎? 由於我是正則表達式的新手,請多加解釋。
RewriteRule ^index.htm$ news/index.htm
RewriteRule ^news/$ news/index.htm
RewriteRule ^news/([0-9]+)$ news/index_$1.htm
您可以將其中兩個合並為一條規則,但最后一條需要分開:
RewriteRule ^(index\.htm|news/)$ news/index.htm [L]
RewriteRule ^news/([0-9]+)$ news/index_$1.htm [L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.