即使使用 htaccess 重定向,googlebot 也会索引我的 index.php 吗?

发布于 2024-09-25 07:20:29 字数 473 浏览 4 评论 0原文

在我的 htaccess 文件中使用重定向语句,在地址栏中输入以下内容的人...

http://example.com/index.php

...将被重定向到...

http://example.com/

我的网站的所有页面上也有一个 noindex、nofollow 元标记。

我的问题是,考虑到重定向行为和元数据,如果我的 robots.txt 文件如下,googlebot 是否会索引我的主页(即 index.php)...

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

User-agent: *
Disallow: /

如果不是,我应该如何更改我的 robots.txt,以便只有我的主页将被谷歌索引,仅此而已?

提前致谢!

Using a redirect statement in my htaccess file, people who type the following into the address bar...

http://example.com/index.php

...are redirected to...

http://example.com/

I also have a noindex, nofollow meta tag on all my website's pages.

My question is, given that redirect behavior and meta data, will googlebot index my mainpage (i.e. index.php) if my robots.txt file is as follows...

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

User-agent: *
Disallow: /

If not, how should I change my robots.txt so that only my mainpage will be indexed in google and nothing more?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忆离笙 2024-10-02 07:20:29

这是有风险的。为了确保 Google 确实为您的主页建立索引,请执行以下操作:

User-agent: *
Allow: /index.php
Disallow: /a
Disallow: /b
...
Disallow: /z
Disallow: /0
...
Disallow: /9

因此您的根“/”将不匹配禁止规则。

另外,如果您有 AdSense,请不要忘记添加

User-agent: Mediapartners-Google
Allow: /

It's risky. To be sure that Google does index your homepage make this:

User-agent: *
Allow: /index.php
Disallow: /a
Disallow: /b
...
Disallow: /z
Disallow: /0
...
Disallow: /9

So your root "/" will not match disallow rules.

Also if you have AdSense don't forget to add

User-agent: Mediapartners-Google
Allow: /
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文