0
我有以下.htaccess,我試圖在/public/robots.php中執行/robots.txt。 我嘗試不同的方法,但沒有執行我的PHP腳本...Zend Framework 1自定義robots.txt在.htaccess中
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/css application/x-javascript application/javascript text/html text/plain text/xml text/json application/json
</IfModule>
SetEnv APPLICATION_ENV "development"
php_flag magic_quotes_gpc off
php_flag register_globals off
php_flag short_open_tag on
RewriteEngine on
RewriteRule !\.(ico|js|css|jpeg|jpg|png|bmp|gif|pdf|doc|docx|xls|xlsx|xmlx|xml|pps|eml|txt|psd|flv|swf|fla|mp3|ttf|eot|svg|woff|zip)$ public/index.php [NC,L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ public/$1 [L]
我如何使用動態的robots.txt,執行/public/robots.php?
Thx!
當您從瀏覽器請求/robots.txt時,您會得到什麼結果?特別是狀態碼和任何錯誤輸出?另外,如果直接請求/public/robots.php,會得到什麼結果? – plasticinsect 2014-10-07 19:54:02
robots.txt返回404找不到。和robots.php返回'Mensagem:沒有路線匹配請求' – 2014-10-07 19:55:55
我解決了這個問題,我會在這裏發佈我的解決方案 – 2014-10-07 19:59:21