如果robots.txt不存在,则会在robots.php上保留,但如果存在,则返回robots.txt
RewriteEngine on
RewriteCond %{robots.txt} !-f [NC]
RewriteRule robots.txt robots.php [L]
此代码始终返回robots.php
答案 0 :(得分:2)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/robots\.txt/$ robots.php [L]
认为这就是你需要的......