html - 如何在搜索引擎中获取 http ://mysite. com/indexed,而不是 http ://mysite. com/index.php,仅此而已?

标签 html seo robots.txt

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

http://mysite.com/
indexed, not...

http://mysite.com/index.php
I only want to allow indexing of the main page of the website, and nothing more. I do not want the bot to follow any of the links on the main page.

My meta tags include the following::

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

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

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

User-agent: *
Disallow: /

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

提前致谢!

最佳答案

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

关于html - 如何在搜索引擎中获取 http ://mysite. com/indexed,而不是 http ://mysite. com/index.php,仅此而已?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3765776/

相关文章:

php - 显示一个字段作为主表头的mysql表

javascript - 通过改变div的背景图像来实现动画

mobile - 为什么 Googlebot 会抓取未在任何地方引用的/mobile/* 和/m/* 页面?

javascript - 将 pushstate 与内容重复使用会导致 SEO 问题吗?

php - 关于机器人和内容拦截的几个问题

html - 无法让颜色叠加工作。我错过了什么?

javascript - 用 JavaScript 将两个输入字段的结果结合起来?

angularjs - 带有 Hashbang Route 的 Html5 模式,用于页面上的直接 url

seo - 如何验证 Robot.txt 规则

robots.txt - robots.txt 中的 Noindex