简体   繁体   中英

HTTP to HTTPS through catalogue doesn't work

I have a problem with my .htaccess .

I am forwarding from HTTP to HTTPs in my .htaccess file, without WWW , but I keep getting an error (only shows a white page).

Below you can see my current (working) .htaccess with HTTP . Can anyone give me a tip how to change this code:

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^(www\.)?new\.domain\.com$ [NC]
RewriteRule ^(.*)$ /domain/$1 [L]

RewriteCond %{HTTP_HOST} ^(www\.)?server1660223\.domain\.com$ [NC]
RewriteRule ^(.*)$ /domain/$1 [L]

<Files xmlrpc\.php>
Deny from all
</Files>

You can use this:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(?:www\.)?example\.com$
RewriteRule ^(.*)$ https://example.com%{REQUEST_URI} [L,R=301]

This will remove www from your URLs and then force HTTPs as well. Make sure you clear your cache before testing this.

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