【发布时间】:2019-07-13 15:03:59
【问题描述】:
因此,由于某种原因,爬虫不断地在现有 URL 的末尾提取带有 "/index.html" 的 URL 并报告 404。
例子:
domain.com/index.html
domain.com/pricing/index.html
domain.com/solutions/index.html
domain.com/solutions/project-management/index.html
问题是,在我们的网站上,我们有例如"domain.com/pricing"。但是我们真的没有"domain.com/pricing/index.html"。
我想知道:
- 首先是什么导致这些 URL 出现在搜索引擎上?
- 是否有任何快速解决方法可以将
"domain.com/whatever/index.html"之类的内容重定向到"domain.com/whatever"?
这件事困扰了我一段时间!
【问题讨论】:
-
你在使用 Apache 吗?如果是这样,您的 .htaccess 文件中有什么内容?
-
一些爬虫会根据已经访问过的 URL 猜测常见的 url,然后尝试这些 - 你无法阻止爬虫猜测。至于如何重定向,这将根据您使用的 Web 服务器软件而有所不同 - Apache、NGINX、Lighttpd、IIS 等,因此值得在您的问题中包含这些信息。
-
我认为是 nginx。这是我们的 .htaccess 文件中的内容 # BEGIN WordPress
RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule 。 /index.php [L] # 结束 WordPress
标签: html redirect seo http-status-code-404