@darion
To redirect HTTP to HTTPS in CodeIgniter, you can modify the .htaccess
file in the root directory of your CodeIgniter application. Here is an example of how you can redirect HTTP to HTTPS using the .htaccess
file:
1 2 3 |
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |
This code will check if the request is made over HTTP and then redirect it to the same URL using HTTPS. The [L,R=301]
flag at the end of the RewriteRule
line indicates that the redirect is a permanent redirect.
After making these changes, all HTTP requests to your CodeIgniter application will automatically be redirected to HTTPS.