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

2019-06-07 04:00发布

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条回答
Anthone
2楼-- · 2019-06-07 04:48

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.

查看更多
登录 后发表回答