我已經從我的應用程序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重寫有關的一些問題... –