我已经从我的应用程序URL中移除了index.php,就像在网络上显示的一样。但之后我有一个奇怪的问题。从URL中删除index.php后,无法使用抓取工具访问网页
我可以像这样使用浏览器访问网站... http://www.oakquotes.com/quotes/author/etc-etc
(注意缺少index.php),但是当我尝试使用爬虫访问相同的URL时,我得到了禁止403 http错误。
这里是robots.txt文件:
User-agent: *
Allow:/quotes/topic
Allow:/quotes/author
Disallow:
Sitemap: http://www.oakquotes.com/Sitemap.xml
Sitemap: http://www.oakquotes.com/author_sitemap.xml
Sitemap: http://www.oakquotes.com/topic_sitemap.xml
我认为罪魁祸首是我写来从URL中删除index.php文件中的.htaccess规则。以下是htaccess的代码:
<IfModule mod_rewrite.c>
# For security reasons, Option followsymlinks cannot be overridden.
# Options +FollowSymlinks
Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteBase/
RewriteCond $1 !^(index\.php|images|robots\.txt|Sitemap\.xml|topic_sitemap\.xml|author_sitemap\.xml|search\.html|style|js|system|application|quotes/authors|quotes/topic|application/controllers|application/views)
RewriteRule ^(.*)$ ./index.php/$1 [L]
</IfModule>
我是否缺少一个步骤?在这方面请帮助我。谢谢。
是什么,当你得到403错误日志中说,将打印错误消息? –
*您确定抓取程序正在使用主机标头? *爬虫是否能够访问此网站? *访问和错误日志说什么? *爬虫程序是否提供了有关它所得到的响应的更多细节? – Cal
是的,它说foorbidden 403响应中的http状态...日志不显示任何实际...我认为它与url重写有关的一些问题... –