链接在谷歌搜索结果中不重定向到预期的页面按的.htaccess

编程入门 行业动态 更新时间:2024-10-10 13:19:26
本文介绍了链接在谷歌搜索结果中不重定向到预期的页面按的.htaccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我原来问了一个问题的.htaccess here并得到了一些真棒的帮助,开展工作的一种享受。基本上,我试图重定向从旧的网站页面到一个新的网站,并设法使大多数事情的工作。然而,有一对夫妇在谷歌的搜索结果链接未重定向正确的,我相信这是因为他们都WWW和新的网站重定向到非www。例如,像这样在搜索引擎结果中的链接:

I originally asked a .htaccess question here and got some awesome help, which worked a treat. Basically, I'm trying to redirect pages from an old site to a new site, and have managed to make most things work. However, there's a couple of links in Google's search results that aren't redirecting properly, and I believe this is because they're all www and the new site redirects to non-www. For example, a link like this in the search engine results:

www.example/Expertise/ProductTesting

www.example/Expertise/ProductTesting

应该去:

example/services/product-testing

example/services/product-testing

不过,而不是去:

example/services/ProductTesting

example/services/ProductTesting

所以由于某些原因URL的最后部分是不变化的。下面是这条线看起来在我的.htaccess:

So for some reason the last part of the URL isn't changing. Here's how that line looks in my .htaccess:

RedirectMatch 301 ^/Expertise/ProductTesting/?$ /services/product-testing/

如果我手动输入在地址并删除了www,它重定向所应当。

If I type the address in manually and drop the www, it redirects as it should.

在此先感谢!

推荐答案

以你的previous问题纳入考虑,你必须把你的新规则的之前这是匹配的一切的一种: RedirectMatch 301 ^ /专业/(.*)$ /服务/ $ 1 。

Taking your previous question into consideration, you must put your new rule before the one that is matching everything: RedirectMatch 301 ^/Expertise/(.*)$ /services/$1.

此外,你也许已经再次开始前清除浏览器的缓存(或尝试用其他浏览器)。

Also, you'll maybe have to clear your browser's cache before trying again (or try it with another browser).

您的规则应该是这样的。

Your rules should look like this

RedirectMatch 301 ^/Expertise/QuantitativeResearch/?$ /services/quantitative-research/ RedirectMatch 301 ^/Expertise/ProductTesting/?$ /services/product-testing/ RedirectMatch 301 ^/Expertise/(.*)$ /services/$1

更多推荐

链接在谷歌搜索结果中不重定向到预期的页面按的.htaccess

本文发布于:2023-11-28 20:33:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643862.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:搜索结果   中不   重定向   页面   链接

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!