Answer the question
In order to leave comments, you need to log in
Correct .htaccess setting. How to set up a redirect of all pages from http to https (there are additional conditions)?
The task is somewhat more difficult than it seems at first glance.
There is one domain HTTP://site1.com
There is a second domain HTTPS://site2.com which is redirected from HTTP://site1.com and from HTTP://site2.com by a plugin in CMS Wordpress.
The site has about 300 pages and they are constantly updated. Naturally, it is necessary that all pages from both HTTP://site1.com and HTTP://site2.com are automatically redirected to the secure version of the site, i.e. at https://site2.com .
Actually there is such a standard code
# 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
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Answer the question
In order to leave comments, you need to log in
Elementary:
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question