Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要将所有以 CAPS 开头的页面重定向为小写,这样可以正常工作;
RewriteRule ^(?=.*?[A-Z])(apartments/.*)$ /${lc:$1} [R=301,L]
这重定向很好,但问题是当我尝试重定向成功的目录时apartments/London/South => apartments/london
apartments/London/South => apartments/london
它将全部重定向到小写而不是新方向。
感谢您的帮助。
您的规则适用于我的 apache,但可能是因为版本不同。你能试一下吗:
RewriteCond %{REQUEST_URI} [A-Z] RewriteRule ^(apartments(?:/.*|))$ /${lc:$1} [R=301,L]
确保在不同的浏览器中对此进行测试或清除浏览器缓存。