0

I have an SSL certificate installed on the server. Now I want to switch to https:// instead of http:// as the site is showing as "not secure".

I've updated the siteUrl and baseUrl in config/general.php:

  ),
  'www.website.com.au' => array(
    'devMode' => false,
    'siteCached' => true,
    'omitScriptNameInUrls' => true,
    'allowAutoUpdates' => false,
    'siteUrl' => 'https://www.website.com.au/',
    'environmentVariables' => array(
      'baseUrl' => 'https://www.website.com.au/',
    ),
  ),

That didn't do anything.

Then, I tried updating these rules in the .htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
</IfModule>

updated to:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
</IfModule>

and

<IfModule mod_rewrite.c>
    RewriteEngine On

  RewriteCond %{HTTP_HOST} !^www\.
  RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

  RewriteCond %{HTTP_HOST}%{REQUEST_URI} www.website.com.au/home$
  RewriteRule ^(.*)$ http://www.website.com.au [R=301,NC,L]

  RewriteCond %{HTTP_HOST}%{REQUEST_URI} www.website.com.au/about-us$
  RewriteRule ^(.*)$ http://www.website.com.au/about-us/our-story [R=301,NC,L]

...

updated to:

<IfModule mod_rewrite.c>
    RewriteEngine On

  RewriteCond %{HTTP_HOST} !^www\.
  RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

  RewriteCond %{HTTP_HOST}%{REQUEST_URI} www.website.com.au/home$
  RewriteRule ^(.*)$ https://www.website.com.au [R=301,NC,L]

  RewriteCond %{HTTP_HOST}%{REQUEST_URI} www.website.com.au/about-us$
  RewriteRule ^(.*)$ https://www.website.com.au/about-us/our-story [R=301,NC,L]

...

These updates to .htaccess work for the home page, but when I visit any other page, the URL is https, but the page displays a 404 Not Found error.

How do I switch to https properly?

Thanks

3
  • I think obtain an SSL is a server issue not a problem can be solved by either "craft" or ".htaccess". You need to figure out what server software you are using. E.g. "Apache" or "Nigix" being the most popular for craft, after that research how to install SSL for it. Jul 12 '19 at 8:25
  • I have an SSL certificate installed
    – User543
    Jul 14 '19 at 23:42
  • Since you are using htaccess, then you are using apache server. You need to find your httpd.conf file where writes the <VirtualHost *:80> ... </VirtualHost> And simply put code Redirect permanent / https://your-domain.com.au in it. Jul 16 '19 at 2:22

Your Answer

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

Browse other questions tagged or ask your own question.