在子目录中创建无限其他页面

时间:2014-08-05 18:32:14

标签: php html regex .htaccess url

我试图找到问题的根源Moz的爬虫被卡住了。我们需要解决的简单问题是我们有相同页面的重复,即:

/capabilities/  
/capabilities/index.html

少数或目录发生了这个问题。但是我们也有一个问题似乎是无限循环的页面可以访问,只是为了这个子目录:

/customer_service.html/  
/customer_service.html/contact/index.html  
/customer_service.html/contact_us/contact_form.php  
/customer_service.html/contact/contact/contact/contact/index.html
/customer_service.html/contact/contact/contact_us/contact_form.php
/customer_service.html/contact_us/contact/contact/contact/index.html
/customer_service.html/contact_us/contact/contact/contact_us/contact_form.php
/customer_service.html/contact/contact_us/contact/contact_us/contact_us/contact/index.html

一直在继续......我认为它已经停止爬行只是因为它达到了24,000页。所有这些页面实际上都有效真的只需要两页:一页用于客户服务常见问题解答,另一页用于联系公司。

我是营销人员,而不是开发人员,所以我所知道的是这是一个问题。我想知道我们是否可以使用htaccess修复此问题,或者是否存在其他问题。在我看来,所有这些其他页面都需要被消除,而不仅仅是重定向。感谢。

编辑:为说明和漫画目的添加了更多示例

1 个答案:

答案 0 :(得分:0)

有两件事要做。

就像你说的那样,不允许这些URL重定向到主页面。显示.htaccess文件中的内容,我将了解如何更改它。

另一方面,解决症状是不够的。你必须治愈疾病。这意味着您的网站上有一些不正确的链接。最有可能这些是缺少初始斜杠的相对URL(联系人而不是/ contact)。