Before setting up https for Joomla, you need to perform a number of simple steps. First, save a backup copy of the site and database. This is optional, but strongly recommended. If something goes wrong, you can restore the latest working version of the site.
Secondly, you need to buy an https certificate from the provider and install it. After that, you can start setting up.
How to enable HTTPS in Joomla admin panel?
To correctly configure https for Joomla, just follow the instructions below:
- Log in to the administrative panel of the web resource. To do this, go to the URL of the form http://sait.ua/administrator/.
- Select "System" - "General settings".
- Go to the "Server" tab. In the "Select SSL" section, select the "Entire site" option. Then apply the changes.
Next, you need to edit the configuration.php file. For example, via FTP. It is located in the root directory of the website.
In the file, you need to find a line with the parameter $ live_site and write a new site domain with https. As a result, it will look like this:
public $ live_site = 'https://site.ua';
Be sure to save the file
Sometimes editing is disabled by default. This is done for maximum safety.
In this case, before making changes, set the access rights to 644 for the file. After that, you can save the changes made.
Edits in .htaccess
You also need to edit the .htaccess file. In this case, it is configured so that all visitors who entered the site at the old address (from http) are automatically redirected to the new one (from https).
To do this, write the following lines in the file :
RewriteEngine On
RewriteCond% {HTTPS} OFF
RewriteRule (.*) Https://%{HTTP_HOST}%{REQUEST_URI}
Error elimination
After performing the necessary manipulations, the Joomla site may not work correctly. Sometimes mistakes happen.
For example, "mixed content" errors may be displayed in the browser console. To eliminate them, add a line to configuration.php
$_SERVER ['HTTPS'] = 'on';
It is written at the very end.
And write the following lines in .htaccess:
RewriteCond% {HTTP: X-HTTPS} ^ $1
RewriteRule.? - [E = HTTPS: on]
Also note that different components have their own options for switching to HTTPS for Joomla. For example, for VirtueMart, you need to do the following:
- Select "Components" - "VirtueMart"
- Select "Settings" - "Store".
- Activate the "Enable SSL for important parts of the site" option.
The rest of the links with "mixed content" errors will have to be corrected manually. In the browser console, it is clearly visible that the old http address is being downloaded. This should be corrected. This is how to set up https for Joomla. There is nothing complicated - especially if you follow the instructions. And even if mistakes occur, they can be easily corrected.