htaccess 将具有特定单词的文件夹重定向到它们自己的 parent 文件夹
htaccess redirect folders with specific word to their own parent folder
新网站上线,旧网站利用了一堆无用的"feeds"。
正在寻找 .httaccess 301 重定向命令以将其中包含 "feed" 的任何内容重定向到其 parent 文件夹。有几千个,想办法一举搞定。
以下是 "folders" 的示例(实际上是 WordPress 页面):
http://example.com/listing/listing-name/feed/
http://example.com/listing/listing-name2/feed/
其中 "listing" 始终保持不变,但 "listing-name" 和 "listing-name2" 表示不同的项目。
我希望他们被重定向到他们的 parent "folder",像这样:
http://example.com/listing/listing-name/
http://example.com/listing/listing-name2/
如有任何帮助,我们将不胜感激。
谢谢!
您可以使用此重定向规则作为您的首要规则:
RewriteEngine On
RewriteRule ^(.+/)feed/?$ / [L,NC,NE,R=301]
# more rules below this
新网站上线,旧网站利用了一堆无用的"feeds"。
正在寻找 .httaccess 301 重定向命令以将其中包含 "feed" 的任何内容重定向到其 parent 文件夹。有几千个,想办法一举搞定。
以下是 "folders" 的示例(实际上是 WordPress 页面):
http://example.com/listing/listing-name/feed/
http://example.com/listing/listing-name2/feed/
其中 "listing" 始终保持不变,但 "listing-name" 和 "listing-name2" 表示不同的项目。
我希望他们被重定向到他们的 parent "folder",像这样:
http://example.com/listing/listing-name/
http://example.com/listing/listing-name2/
如有任何帮助,我们将不胜感激。
谢谢!
您可以使用此重定向规则作为您的首要规则:
RewriteEngine On
RewriteRule ^(.+/)feed/?$ / [L,NC,NE,R=301]
# more rules below this