2

I set up a bilingual site pointing to 2 different domains for a client. My client then started receiving comments about unusual behavior, and digging a little I found out they (unknowingly) signed up for an HTTPS account while being on shared hosting and not having an SSL certificate.

I understand I can revert this by going to settings.php and force HTTP writing:

$base_url = 'http://example.com';

My question is if this is the correct way to handle this and I don't need to change anything else (like .htaccess); also, I have a different domain for a Spanish version of the site, could this domain be affected by pointing $base_url to the English domain? should I add both?

  • Surely you could change your hosting account to not do https? Have you contacted hosting support? – rooby Mar 16 '14 at 2:03
  • I did, but they told me to change settings via Drupal or phpmyadmin. – brunn Mar 16 '14 at 5:24
1

I would do the https to http redirect inside of .htaccess. Setting the base_url in settings.php will only fix it after the user clicks on a link. The landing page will still be https. I would use something like this in your .htaccess file:

RewriteCond %{HTTP_X_FORWARDED_PROTO} ^https$ [or]
RewriteCond %{HTTPS} ^on$
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  • Thank you mikeytown2. One question: doing this will I be redirected if I intentionally type site.name.com on the address bar? – brunn Mar 15 '14 at 18:31
  • It will redirect ALL https to http. So that address in the address bar will be 301 redirected to http. – mikeytown2 Mar 15 '14 at 19:03
  • Then I did something wrong, I copied your suggestion on my .htaccess (substituted the original lines at the beginning of the file) but I still get the 'this connection is untrusted' page when I type the https domain. – brunn Mar 15 '14 at 19:15
  • I added in the HTTP_X_FORWARDED_PROTO check. Try again and be sure to put in where the other redirect rewrite rules are inside of .htaccess but before the index.php rule. If that still doesn't work you might have to restart apache for the changes to stick. Example on debugging this if the .htaccess changes are not taking effect: drupal.org/comment/8577333#comment-8577333 – mikeytown2 Mar 15 '14 at 22:11
  • The bottom rewrite is redirecting anything missing the www (domain.com) to index.php? – Rankinstudio Sep 29 '18 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.