Php 尝试访问robot.txt文件时出现404错误-Wordpress

Php 尝试访问robot.txt文件时出现404错误-Wordpress,php,wordpress,.htaccess,Php,Wordpress,.htaccess,我已经在Wordpress中创建了web应用程序。我已经上传了robot.txt,但当我尝试访问该文件(如www.domain.com/robot.txt)时,会出现404页面未找到错误。我已经在htaccess文件中实现了robot.txt的代码,即使它不工作。 我使用了以下htaccess代码 # BEGIN WordPress htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule

我已经在Wordpress中创建了web应用程序。我已经上传了robot.txt,但当我尝试访问该文件(如www.domain.com/robot.txt)时,会出现404页面未找到错误。我已经在htaccess文件中实现了robot.txt的代码,即使它不工作。
我使用了以下htaccess代码

# BEGIN WordPress htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

RewriteRule ^robots.txt - [L]
</IfModule>

# END WordPress htaccess
#开始WordPress htaccess
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
重写规则^robots.txt-[L]
#结束WordPress访问

尝试访问robot.txt文件时出现404错误-Wordpress

您将robots.txt文件放在哪里了?请检查日志/var/logs/apache2/error.log/var/logs/apache2/access.log查看请求的去向,同时查找www数据用户的权限。这是用于运行WebServer的用户尝试将
www.domain.com/robot.txt
更改为
www.domain.com/robots.txt
(您在
robots
中缺少
s
)。如果它位于根文件夹(其中有.htaccess文件和index.php),则不需要在htaccess中为其添加规则。等等。。。标题上说你有一个404错误,但你在文章结尾说你有一个500错误?是哪一个?这是两个完全不同的错误。你完全正确@MagnusEriksson