重定向此时我遇到了问题。它没有正确重定向。有没有人知道如何有效地写这个。
redirect 301 /maldives-accommodation/luxury-boutique-hotels/ /hotels-resorts/luxury-boutique-hotels.html
redirect 301 /maldives-accommodation/luxury-star-class-hotels/ /hotels-resorts/luxury-star-class-hotels.html
redirect 301 /maldives-accommodation/maldives-villas/ /hotels-resorts/villas.html
redirect 301 /maldives-accommodation/ /hotels-resorts.html
答案 0 :(得分:1)
Redirect
指令将两个URL路径节点链接在一起,因此您可能希望使用类似RedirectMatch
的内容,以便模式之后的所有内容都将被忽略:
RedirectMatch 301 ^/maldives-accommodation/luxury-boutique-hotels/$ /hotels-resorts/luxury-boutique-hotels.html
RedirectMatch 301 ^/maldives-accommodation/luxury-star-class-hotels/$ /hotels-resorts/luxury-star-class-hotels.html
RedirectMatch 301 ^/maldives-accommodation/maldives-villas/$ /hotels-resorts/villas.html
RedirectMatch 301 ^/maldives-accommodation/$ /hotels-resorts.html