[英]Thousands .htaccess redirect 301
我的網站上有1500個帖子需要重定向。
由於類別沖突,因此無法重定向完整類別。 當前結構如下:
汽車類別
Redirect 301 /blog/videos/top-5-cars http://www.example.net/articles/cars/videos/top-5-cars
假期類別
Redirect 301 /blog/videos/exotic-holiday-locations http://www.example.net/articles/holiday/videos/exotic-holiday-locations
由於/ blog / videos /屬於“汽車和度假”類別,因此無法按以下方式重定向
Redirect 301 /blog/videos /articles/holiday/videos
1500篇文章就是這種情況。 在.htaccess中為1500條文章編寫重定向規則是否明智? 有更好的解決方法嗎?
請提出建議。
用可以使用正則表達式進行匹配的RedirectMatch
指令替換您的Redirect
指令,以實現精確匹配。
RedirectMatch 301 ^/blog/videos/top-5-cars/?$ /articles/cars/videos/top-5-cars
RedirectMatch 301 ^/blog/videos/exotic-holiday-locations/?$ /articles/holiday/videos/exotic-holiday-locations
RedirectMatch 301 ^/blog/videos/?$ /articles/holiday/videos
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.