【发布时间】:2021-04-09 16:38:24
【问题描述】:
我试图在 Apache 中编辑 URL,如下所述,但我没有成功。
如果 URI 以字母“a”开头且第三个数字不是“7”且总数字为 6
那么 url http://example.com/a/123456/ 应该重写为 http://example.com/sixdigits.php
如果 URI 以字母“b”开头,并且第三个数字不是“7”且总数字为 4,则 url http://example.com/b/1234/ 应重写为 http://example.com/fourdigits.php
这是我对 .htaccess 文件的尝试。
RewriteRule ^a/[0-9]+/$ sixdigits.php
RewriteRule ^b/[0-9]+/$ fourdigits.php
【问题讨论】:
标签: apache .htaccess mod-rewrite url-rewriting friendly-url