我正在努力应对来自两者的htaccess重定向:
/ folder / subfolder / any-value / 和 / folder /子文件夹/任意值到 / another-folder / any-value /
以下代码适用于
/ folder /子文件夹/ any-value / 到 / another-folder / any-value /
但不是:
/ folder /子文件夹/任意值到 / another-folder / any-value /
RewriteRule ^england/devon-cornwall/(.*)/$ https://www.example.com/large-houses/$1/ [R=301,L]
作为额外的crtiera,网址 / folder / subfolder / 应保持不变。
我已经搜索了高位和低位以修复网址上的尾部斜杠问题,但找不到任何内容。请有人帮忙吗?谢谢!
答案 0 :(得分:0)
尝试:
RewriteRule ^england/devon-cornwall/(.*)/?$ https://www.example.com/large-houses/$1/ [R=301,L]
/?
表示/
是可选的,因此它将uri与traling斜杠匹配,uri在末尾没有斜杠。
在测试此
之前清除浏览器缓存