Redirect http to https in Codeigniter
I go through StackOverflow for similar questions, but I need something different!
I want to redirect all traffic of my site to HTTPS and without www. WHAT FOR? my free SSL certificate doesn't work with "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>
+3
source to share
1 answer
If Let's Encrypt free certificate, you can also extend the certificate to subdomain www
. But from an SEO perspective, it's best to focus your traffic on just one of them. For the redirection you want, I think Gumbo's answer might be helpful. For more useful .htaccess
snippets check this page .
+1
source to share