Have you ever installed your SSL Certificate on your website and everything is broke?

There is nothing like just securing your website and everything goes wrong. Your CSS doesn’t load correctly or even your browser is letting you know the connection is not private.

First issue I’ve seen is links on your website can break your SSL Certificate from securing the connection.

This issue shows an info symbol instead of the locked symbol showing your users that the site is not fully protected. A quick fix to never see this issue again is to start coding your internal links with Relative File Paths instead of Absolute File Paths.

Example Absolute File Path: http://www.example.com/index.html
Example Relative File Path: /example.com/index.html

By looking at the first example above was coded for a non-SSL website which is fine until you install your SSL Certificate on that specific domain every link now is being called into your website insecurely which becomes blocked before loading into your website. Now if you start coding using the second example with Relative File Paths then there will never be a problem due to the fact that both versions http:// and https:// can be called without breaking your site.

Second issue I’ve seen is external links that need to be coded with Absolute File Paths. Like embedding a youtube video on your website.

To solve this issue is pretty simple as well and this is how I go about this issue to ensure the SSL will never break.

In your root direct of your website add a file called .htaccess and save.

Next, take this snippet of code and paste right into your .htaccess file.

<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Now depending on your host, you may need to add Options -Multiviews and Options +FollowSymLinks at the top of your .htaccess file to ensure this works.

Now with this module rewrite rule, your website will always display the https:// version of your website no matter if your user put in http://. If http:// is inputted into their browser your server will redirect quickly to the secure version of your website.

Categories: Blog


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *