由网友(心如不暖之夏)分享简介:下面是我目前的.htaccess文件。我想补充的另一个条件/规则的,如果对sitemap.xml的一个请求,sitemap.php供应代替。请帮助:)选项+了FollowSymLinks< IfModule mod_rewrite.c>RewriteEngine叙述上的RewriteBase /的Rewri...![sitemap.xml 怎样手动更新](https://p.xsw88.cn/allimgs/daicuo/20230902/273.png)
下面是我目前的.htaccess文件。我想补充的另一个条件/规则的,如果对sitemap.xml的一个请求,sitemap.php供应代替。请帮助:)
选项+了FollowSymLinks
< IfModule mod_rewrite.c>
RewriteEngine叙述上
的RewriteBase /
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^(。*)$的index.php?文件名= $ 1 [L,QSA]
< / IfModule>
解决方案
您可以明确地做到这一点:
选项+了FollowSymLinks
< IfModule mod_rewrite.c>
RewriteEngine叙述上
的RewriteBase /
重写规则^ sitemap.xml的$ sitemap.php [L]
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^(。*)$的index.php?文件名= $ 1 [L,QSA]
< / IfModule>
![sitemap.xml 怎样手动更新](https://p.xsw88.cn/allimgs/daicuo/20230902/273.png)
您很可能会遇到一些问题这样做虽然...你应该创建排除蜘蛛,使他们仍然收到sitemap.xml的
below is my current .htaccess file. I would like to add another condition/rule where if a request for sitemap.xml is made, sitemap.php is served instead. Please help : )
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>
解决方案
You could do it explicitly:
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>
You'll likely run into problems doing this though... You should create exclusions for spiders so they still receive the sitemap.xml
相关推荐
最新文章