Zend Framework - Where to put the robots.txt file?

跟風遠走 提交于 2019-12-23 02:52:36

问题


Zend framework i have directory tree as following with robots.txt file, but when i browse www.site.com/robots.txt , it says page not found error. How do i tell ZF that robots.txt is allowed?

A. Directory tree:

wwwsite/application
wwwsite/library
wwwsite/ZendFramework-1.10.7.tar.gz
wwwsite/public
.
|--- captcha
|
|--- css
|--- js
|--- img
|--- files
|
.htaccess
index.php
robots.txt

B. .htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

Thank you Regards


回答1:


To explain why it doesn't work with empty robots.txt:

It's because rewrite cond -s is used which checks if a file is matched but also if the file is greater than 0 in size. If you want to match empty files as well you can use -f instead of -s.



来源:https://stackoverflow.com/questions/3533427/zend-framework-where-to-put-the-robots-txt-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!