Rajbir
Rajbir

Reputation: 15

How can I configure SSL of codeigniter site?

My .htaccess file

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Upvotes: 1

Views: 46

Answers (2)

Pathik Vejani
Pathik Vejani

Reputation: 4491

Copy below code and paste in your .htaccess file:

#First rewrite any request to the wrong domain to use the correct one (here www.)
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

#Now, rewrite to HTTPS:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Upvotes: 1

NID
NID

Reputation: 3294

you should have something like this

RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Try to replace your rule with this

Upvotes: 2

Related Questions