【发布时间】:2021-02-11 05:25:07
【问题描述】:
我有一个 URL,我需要在其中添加一个段 /#!/。
这不起作用,因为我得到了一个循环。
Options +FollowSymLinks
RewriteEngine On
RedirectMatch "/constantsegment/(.*)" "/constantsegment/#!/$1"
例如,假设我的网址是http://example.com/constantsegment/changeablesegment。我需要将网站重定向到http://example.com/constantsegment/#!/changeablesegment。
请注意,在constantsegment 和changeablesegment 之间有一个名为#! 的URL 段(文件夹)。
我遇到的问题是在尝试将/#!/ 附加到/constantsegment/ 时创建了一个重定向循环。我怎样才能将/#!/ 添加到末尾,然后添加所有其他段。
再次
http://example.com/constantsegment/changeablesegment
应该重定向到
http://example.com/constantsegment/#!/changeablesegment
另一个例子(在这种情况下产品是常量段)
http://example.com/products/cars/blue
应该重定向到
http://example.com/products/#!/cars/blue
【问题讨论】:
标签: .htaccess url redirect mod-rewrite url-rewriting