问题描述
我大约有3500个页面将更改URL,因为我需要从URL中删除一个关键字。我将向Google提交更新的站点地图,但我还要提供一段时间的 htaccess 301重定向。
I have about 3500 pages that will change URL because I need to remove one keyword from the URL. I will submit an updated sitemap to google but I would also like to provide htaccess 301 redirects for a while.
旧网址示例
新网址是
旧网址示例
新网址是
需要删除的关键字
我的htaccess中有3500条单独的301重定向行可能会使我的服务器速度变慢,并且我认为这样做不明智
Having 3500 individual 301 redirect lines in my htaccess would probably slow down my server and I don't think it's wise to do.
所以我问什么是应用这3500次重定向的最佳方法?
请提供示例代码。
So I am asking what would be the best way to apply these 3500 redirects?Please provide code examples for your suggestions.
谢谢。
推荐答案
您可以在根.htaccess中仅在此处使用 RedirectMatch
规则:
You can just use a RedirectMatch
rule here in your root .htaccess:
RedirectMatch 301 ^(.+?)-old(.*)$ /$1$2
这篇关于使用301 htaccess重定向多个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!