gpt4 book ai didi

mod-rewrite - 从 URL 中删除 SID 并使用 .htaccess 重定向 301

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:32:40 25 4
gpt4 key购买 nike

我们在谷歌搜索结果中有一些带有 SID 的 URL,我们希望 301 重定向到没有 SID 的页面。所以我们需要一个 URL 重写来改变这个 URL

http://www.in-due.de/hochzeitsshop/catalogsearch/result/index/?SID=8df077eea401bda0da7e9a980efe20cf&cat=148&dir=asc&limit=9&order=relevance&p=8&q=gold

进入这个网址:

http://www.in-due.de/hochzeitsshop/catalogsearch/result/index/?cat=148&dir=asc&limit=9&order=relevance&p=8&q=gold

基本上删除这部分:

SID=8df077eea401bda0da7e9a980efe20cf&

有人可以帮忙吗?

最佳答案

登录到 Google 的网站管理员工具,在网站配置、参数处理下,您需要将 SID 添加到列表中,您可以手动删除 URL,但我会简单地使用这个 robots.txt 文件并让机器人拾取以删除那些带有 session ID 的 URL。

这是我一直用于 Magento 网站的 robot.txt 文件。显然,您可能希望根据需要进行调整:

# $Id: robots.txt,v magento-specific 2010/28/01 18:24:19 goba Exp $
#
# robots.txt
#
# This file is to prevent the crawling and indexing of certain parts
# of your site by web crawlers and spiders run by sites like Yahoo!
# and Google. By telling these "robots" where not to go on your site,
# you save bandwidth and server resources.
#
# This file will be ignored unless it is at the root of your host:
# Used: http://example.com/robots.txt
# Ignored: http://example.com/site/robots.txt
#
# For more information about the robots.txt standard, see:
# http://www.robotstxt.org/wc/robots.html
#
# For syntax checking, see:
# http://www.sxw.org.uk/computing/robots/check.html

# Website Sitemap
Sitemap: http://www.yourdomain.com/sitemap.xml

# Crawlers Setup
User-agent: *
Crawl-delay: 10

# Allowable Index
Allow: /*?p=
Allow: /index.php/blog/
Allow: /catalog/seo_sitemap/category/
Allow: /catalogsearch/result/

# Directories
Disallow: /404/
Disallow: /app/
Disallow: /cgi-bin/
Disallow: /downloader/
Disallow: /includes/
Disallow: /js/
Disallow: /lib/
Disallow: /magento/
Disallow: /media/
Disallow: /pkginfo/
Disallow: /report/
Disallow: /skin/
Disallow: /stats/
Disallow: /var/

# Paths (clean URLs)
Disallow: /index.php/
Disallow: /catalog/product_compare/
Disallow: /catalog/category/view/
Disallow: /catalog/product/view/
Disallow: /catalogsearch/
Disallow: /checkout/
Disallow: /control/
Disallow: /contacts/
Disallow: /customer/
Disallow: /customize/
Disallow: /newsletter/
Disallow: /poll/
Disallow: /review/
Disallow: /sendfriend/
Disallow: /tag/
Disallow: /wishlist/

# Files
Disallow: /cron.php
Disallow: /cron.sh
Disallow: /error_log
Disallow: /install.php
Disallow: /LICENSE.html
Disallow: /LICENSE.txt
Disallow: /LICENSE_AFL.txt
Disallow: /STATUS.txt

# Paths (no clean URLs)
Disallow: /*.js$
Disallow: /*.css$
Disallow: /*.php$
Disallow: /*?p=*&
Disallow: /*?SID=

关于mod-rewrite - 从 URL 中删除 SID 并使用 .htaccess 重定向 301,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6129458/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com