如果我使用RedirectMatch 301
代码在我的.htaccess
文件:
原文:/automobiles/pickups/?category=classic
重定向:RedirectMatch 301 ^/automobiles/(.*)/?$ /?s=$1 [L]
这会损害我的 SEO 状态吗?
最佳答案
301 是在您的场景中使用的最佳重定向,例如永久重定向。我可以推测通过 301 传递的链接值有非常轻微的恶化,因此最好可以更新原始链接以指向新的目的地。如果你不让其他人更新外部链接,那也没什么坏处。尽管肯定会更新内部链接以指向新网址。
编辑:
我通常使用 RewriteRule 而不是 RedirectMatch 301。
RewriteRule ^/automobiles/pickups/([a-z-]+)$/automobiles/pickups/?category=$1 [R=301,L]
将您的网址 /automobiles/pickups/?category=classic
重写为 /automobiles/pickups/classic
使用 Firefox LiveHeaders 确保访问 /automobiles/pickups/?category=classic
会将 301 返回到 /automobiles/pickups/classic
并更改所有内部内容指向/automobiles/pickups/classic 的链接
关于php - 301 永久重定向以更改 URL 以仅使用带有单个参数的查询字符串是否会损害 SEO?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10080548/