.htaccess(重写https)在Wordpress中导致无限循环,但仅用于Feed



我有一个Wordpress网站,它被迫对来自端口80的任何内容使用.htaccess重定向进行https。只需将Wordpress网站URL标记为https://domain.com似乎不起作用,因此进行了.htaccess修复。

然而,当我尝试访问提要时,它会进入一个无限循环。有没有什么方法可以调整它,这样它就不会将提要重定向到https?根据我对Wordpress的理解,"/feed/"已经在.htaccess中通过重定向进行了处理。

当前代码为:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://domain.co.uk/$1 [R,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

如果我在Wordpress重定向之后将https/port80重定向到,则提要可以工作,但大多数链接/页面不会重定向到https。

我试过各种方法,但都承认失败了。我需要一个apache/htaccess/wordpress专家!!

提前感谢

你能试试这个代码吗:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond  %{SERVER_PORT} 80
RewriteCond  %{THE_REQUEST} !/feed [NC]
RewriteRule ^ https://domain.co.uk%{REQUEST_URI} [R,L,NE]
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

还要确保在新浏览器中进行测试,以避免301缓存问题。

最新更新