Fat Heads tips and techniques logo

Duplicate HTTP and HTTPS in Drupal 7

Sean Turner avatar
by Sean Turner
Digital Director
Posted 09 Nov 2018

Using your .htaccess to remove duplicate content isues with HTTP and HTTPS Drupal 7 links is easily fixed with this technique.

If you are using an SSL certificate on your Drupal 7 website you may have an issue whereby you can access your site via both the HTTP and HTTPS url. This can cause problems for your website with search engines as it is creating duplicates of your pages. You will need to redirect your HTTP url to HTTPS.

Why should your website use HTTPS? HTTPS is most commonly used where sensitive information is sent to a website and if that information were to be intercepted it would be a problem for the user. This information is typically one of the following:

  • Credit cards
  • Cookies such as PHP session cookies
  • Passwords and usernames
  • Identifiable information (name, address, email address, passport number, driving license, national insurance number etc.)
  • Confidential content

To avoid compromising your web site and protecting the sensitive information it is recommended that your website uses HTTPS. To do this you will need to install an SSL certificate on your website.

Most users will not be able to tell the difference between an HTTP and HTTPS website. In fact, the only noticeable difference on the front end of the website is that the URL in the address bar will be https://yourwebsite.com instead of http://yourwebsite.com and a small padlock icon next to it.

To redirect your website from HTTP to HTTPS simply insert the following code in your .htaccess file:

# Redirect to HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

That’s it! Test it and you’re good to go.

Recent articles

Illustrated web design North East England map

Top 5 Website Projects for North East Clients

Transforming web design in Newcastle, Hartlepool and East Durham with these standout projects for educational and community organisations.

14 Jan 2025
Accessible Web Design - East Durham College

Accessible Web Design for Local Education

Learn about essential tips, legal obligations, common barriers, and tools for creating inclusive educational websites.

02 Jan 2025
J Allcocks & Sons website on iMac

Creating a web presence for J. Allcock & Sons LTD

Discover how Fat Heads designed a sleek, eco-friendly website for a 100-year-old leader in rubber recycling and sustainability.

19 Dec 2024
Drupal 7 - End of Life

Drupal 7: A Critical Warning

Discover why Drupal 7 sites are a ticking time bomb for UK businesses. Learn about critical security risks, potential breaches, and how to protect your digital assets now.

29 Nov 2024