I have installed the secure certificate on my website.Both versions are running, I want website automatically redirects to https. The website is created in Drupal.
Asked
Active
Viewed 40 times
0
-
https://www.google.com/search?q=drupal+http+https --> https://drupal.stackexchange.com/questions/24072/how-to-simply-make-the-whole-site-https – ceejayoz Jul 13 '17 at 13:41
-
shall I copy paste this ? RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] – Mohit Thareja Jul 13 '17 at 13:43
-
You should read and understand the documentation. I can't answer "shall I copy paste this", as I don't even know a) what webserver you're using (that'll only work for Apache) nor b) where you plan to paste it *to*. – ceejayoz Jul 13 '17 at 13:44
-
I am using apache server – Mohit Thareja Jul 13 '17 at 13:56
-
1Then follow the instructions on https://www.drupal.org/https-information for Apache. – ceejayoz Jul 13 '17 at 13:57
-
It's better to solve redirection with vhost config file, but if not possible .htaccess is also an option. Explained here: https://stackoverflow.com/questions/13376219/htaccess-redirect-http-to-https – MilanG Jul 14 '17 at 07:37
1 Answers
1
Add the following code to .htaccess
RewriteEngine on
# Redirect to HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

user3575353
- 397
- 1
- 8