问题
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