我要问的问题几乎在标题中。
如何使用.htaccess文件将http://example.org/sitemap.xml转发到https://example.org/sitemap.xml?
我需要这样做,因为我使用的WordPress插件不会索引经过SSL加密的页面,而如果站点地图本身也位于https中,则该页面也会包含在内,因此我如何使用.htaccess来重定向用户,我拥有此功能在我的.htaccess文件中,但它似乎不起作用
# BEGIN Custom Edits
#//301 Redirect Old File
Redirect 301 http://example.org/sitemap.xml https://example.org/sitemap.xml
# END Custom Edits
使用以下规则集:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(sitemap\.xml)$ https://%{HTTP_HOST}/$1 [R,L]
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句