简体   繁体   English

WordPress网站-重定向过多

[英]Wordpress Site - Too Many Redirects

I'm runnning a .ca website, and my site has too many redirects. 我正在运行.ca网站,但我的网站重定向过多。

It goes from 它来自

http://mysite.ca to
https://wwww.mysite.ca to
https://wwww.mysite.ca/

here is my .htaccess file: 这是我的.htaccess文件:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^MYSITE\.ca [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.MYSITE.ca/$1 [L,R=301]
# 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

If you are using ssl certificate add the following code to your wp-config.php file. 如果您使用的是ssl证书,请将以下代码添加到wp-config.php文件中。

if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
       $_SERVER['HTTPS']='on';

see the this post 看到这篇文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM