3

I search across StackOverflow for similar questions, but I need something different!

I want to redirect all my website's traffic for HTTPS and without the www. WHY? my free SSL certificate doesn't work with the 'www.' part.

If I type:

www.andremlsantos.com/somepage
http://www.andremlsantos.com/somepage
http://andremlsantos.com/somepage
https://andremlsantos.com/somepage

I want to redirect to:

https://andremlsantos.com/somepage

My .htaccess

RewriteEngine on
RewriteCond $1 !^(index\.php|css|js|images|subdomain|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
Options -Indexes

<Files 403.shtml>
order allow,deny
allow from all
</Files>

1 Answers1

1

If free certificate is Let's Encrypt you can also extend certificate to www subdomain. But from SEO point of view it is better to concentrate traffic to just one of those. For wanted redirection I think Gumbo's answer can be helpful. For more useful .htaccess snippets check this page.

Tpojka
  • 6,996
  • 2
  • 29
  • 39