After enabling SSL for your website, it’s essential to redirect all traffic to the HTTPS version. There are several methods to achieve this, so let's explore some of the most common options.
Using Script Configuration
If you're using certain scripts, like WordPress, you may find a setting that lets you specify your website’s URL. By changing the URL from http://example.com 203 to https://example.com 81, it’s likely that the script will redirect visitors to the HTTPS version. Even if your script doesn’t automatically redirect users, it’s a good idea to check for this URL setting, as it can help prevent issues with your page links.
Using .htaccess
One of the most popular methods for forcing HTTPS is through the .htaccess file. This plain text file, named .htaccess
, allows you to pass additional instructions to the web server for more complex functions. If you’re using a third-party script, such as a CMS like WordPress, a .htaccess file is likely already available in your website’s htdocs folder. If you do not have one, you can create this file using the File Manager. It’s recommended to use File Manager, since some systems, especially Windows, may struggle with .htaccess files.
Once you locate or create your .htaccess file, you can edit it through the File Manager or any text editor (e.g., Notepad). Add the following lines to the file:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Using Cloudflare Settings
For those using Cloudflare, you can have them enforce HTTPS for you. Simply log in to Cloudflare, navigate to the Crypto settings for your domain, and enable the option for “Always use HTTPS.”
Final Notes on Forcing HTTPS
If your website encounters issues after applying any of these changes, there are a few common problems to investigate.
If your website appears blank or shows a 500 - Internal Server Error when using the .htaccess method, it’s likely that there’s an error in your .htaccess file. Double-check to ensure you copied the content exactly as shown above. If everything seems correct and issues persist, consider seeking assistance in forums. Remember to include your .htaccess file contents in your message for better support.
If your website displays content but is missing styles, scripts, or images, this could be because those files are linked with http:// URLs instead of https://. Most browsers block requests to http:// content from https:// pages for security reasons. Review your script settings (if applicable) or update your pages to ensure they’re only using https:// URLs.