【问题标题】:How to get http://mysite.com/ indexed in a search engine, not http://mysite.com/index.php, and nothing more?如何让 http://mysite.com/ 在搜索引擎中编入索引,而不是 http://mysite.com/index.php,仅此而已?
【发布时间】:2010-09-22 01:46:16
【问题描述】:

我只想在一个搜索引擎中获得...

http://mysite.com/
已编入索引, 不是...

http://mysite.com/index.php
我只想允许索引 网站的主页,仅此而已。我不希望机器人 按照主页上的任何链接。

我的元标记包括以下内容::

<meta name="robots" content="index, nofollow" />

我的 robots.txt 包括以下内容::

User-agent: Googlebot
Allow: /index.php
Disallow: /

User-agent: *
Disallow: /

这会达到我想要的结果吗?

提前致谢!

【问题讨论】:

标签: html seo robots.txt


【解决方案1】:
RewriteCond %{HTTP_HOST}   !^www\.example\.com [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteRule ^/(.*)         http://www.example.com/$1 [L,R=301]

将其放入 .htaccess

这是直接来自Apache's URL Rewriting Guide

【讨论】:

    【解决方案2】:

    指定您的规范:

    来自http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html

    <link rel="canonical" href="http://www.mysite.com/" />
    

    在你的&lt;head&gt;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-11-15
      • 2010-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多