重定向已经重定向的页面
RewriteRule ^teamstore/(.*)/$ /teamproduct.php?teamproduct=$1&products=true [NC,L]
RewriteRule ^teamstore-(.*)/$ /teamproduct.php?teamproduct=$1&products=true [NC,L]
情况是这样的。我们已经重写了这些网址,但我们想要更改这些页面的格式,以便它们由连字符而不是斜杠分隔。
我尝试了重定向匹配,但这在网址末尾添加了额外的 php 值参数。结果是:
RedirectMatch 301 /teamstore/(.*) http://www.domainname.com/teamstore-$1/
结果是...
teamstore-valuehere//?teamproduct=2352323&productes=true
我希望输入原始地址 teamstore/info/ 的人能够定向到 teamstore-info/ - 关于如何实现此目的有什么想法吗?
主要原因是为了避免 Google 搜索结果中现有链接的重复内容问题。
RewriteRule ^teamstore/(.*)/$ /teamproduct.php?teamproduct=$1&products=true [NC,L]
RewriteRule ^teamstore-(.*)/$ /teamproduct.php?teamproduct=$1&products=true [NC,L]
Here's the situation. We've already had theese urls rewritten, but we want to change the formatting of these pages so they're separated by hyphen instead of a slash.
I tried redirectmatch but this added additional php value parameters to the end of the urls. It came out to be
RedirectMatch 301 /teamstore/(.*) http://www.domainname.com/teamstore-$1/
Here was the result...
teamstore-valuehere//?teamproduct=2352323&productes=true
I want someone who types in the original address teamstore/info/ to get directed to teamstore-info/ - Any ideas on how to accomplish this?
The main reason is to avoid duplicate content issues with existing links in Google Search Results.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
规则的顺序可能很重要,但如果您出于 SEO 原因想要 301 重定向初始请求,那么我会将您的 RewiteRules 更改为以下内容。
这将首先将
teamstore/info/
转换为teamstore-info/
并发送适当的 301 响应。第二遍时,它将重定向到您想要的 php。请注意,就性能而言,这并不理想。然而,它确实实现了让谷歌高兴的目标。
Order of the rules can matter, but if you want to 301 redirect the initial request for SEO reasons, then I would change your RewiteRules to the following.
This will first translate
teamstore/info/
toteamstore-info/
and send the appropriate 301 response. Upon second pass it will redirect to the php you want.Note, this is not ideal as far as performance. Yet, it does accomplish the goal of making Google happy.