gpt4 book ai didi

.htaccess URL 重写(sitemap.xml 到 sitemap.php)

转载 作者:行者123 更新时间:2023-12-04 02:11:29 27 4
gpt4 key购买 nike

下面是我当前的 .htaccess 文件。我想添加另一个条件/规则,如果发出对 sitemap.xml 的请求,则改为提供 sitemap.php。请帮助:)

Options +FollowSymLinks

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?filename=$1 [L,QSA]

</IfModule>

最佳答案

你可以明确地做到这一点:

Options +FollowSymLinks

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /

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

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?filename=$1 [L,QSA]
</IfModule>

虽然这样做你可能会遇到问题......你应该为蜘蛛创建排除项,这样他们仍然会收到 sitemap.xml

关于.htaccess URL 重写(sitemap.xml 到 sitemap.php),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16739674/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com