简体   繁体   中英

Cpanel/WHM server can not redirect wordpress site from http to https

I received my certificate through Comodo and installed it through cPanel. It shows up on my browser when I go to the url, but I am unable to get the content of the webpage as I get a 302 redirect loop. I changed my htaccess file to

# BEGIN WordPress
<IfModule mod_rewrite.c>

  RewriteEngine On
  RewriteCond %{SERVER_PORT} 80
  RewriteRule ^(.*)$ https://www.example.org/$1 [R,L]

  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]

</IfModule>
# END WordPress

within the wordpress admin editor, I changed my website from http to https.

Try the following code to redirect from http to https

  RewriteCond %{HTTPS} off
  RewriteRule ^(.*)$ https://www.example.org/$1 [R,L]

create a new .htaccess file with the default rules of wordpress >> In Cpanel redirects options , configure a permanent redirect from http to https with or without www >> you may also need to use a wordpress plugin that apply the proper ssl security to the images and the posts

and then check.

Could you please modifies the https rule in .htaccess

 RewriteEngine On 
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

and also go to wordpress setting and chnage the domain redirection http://example.com to https://example.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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