迁移到AWS Lightail后重写规则不起作用

我的网站以前在共享主机上运行良好,但是将其迁移到新的AWS Lightail服务器后,我无法访问我的sitemap.xml,该网站重定向到sitemap.xml.php以动态表示站点地图。 / p>

Mod_rewrite已启用。

这是我的.htaccess

<IfModule mod_rewrite.c>
RewriteEngine on 


RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included,if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now,rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule sitemap\.xml sitemap.xml.php [L] 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

但是如果我通过sitemap.xml进行访问,index.php是可行的。尽管没有index.php,但我的网站重置令人担忧。

我的虚拟主机文件已启用AllowOverride

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted

我尝试了以下解决方案

RewriteRule ^sitemap\.xml$ sitemap.xml.php [L] 

RewriteBase /
RewriteRule ^sitemap\.xml$ sitemap.xml.php [L] 

RewriteBase /
RewriteRule ^sitemap\.xml$ sitemap.xml.php [L] 
RewriteRule sitemap.xml sitemap.xml.php [L] 

RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteRule ^sitemap\.xml$ sitemap.xml.php [L] 
RewriteRule sitemap.xml sitemap.xml.php [L] 

,但没有任何效果。我有什么想念吗?

sjhranran 回答:迁移到AWS Lightail后重写规则不起作用

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3090405.html

大家都在问