First go to the application/config/config.php file and look for this line:

$config['base_url'] = "";

Set it to your URL with the https e.g. https://example.com

$config['base_url'] = "https://example.com";

Then go to your .htaccess file and add this line in the example given below.

RewriteRule ^(.*)$ https://example.com/$1 [R,L]

<IfModule mod_rewrite.c>

    #Options +FollowSymLinks
    #Options -Indexes
    RewriteEngine on

    # Send request via index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
    RewriteRule ^(.*)$ https://example.com/$1 [R,L]


</IfModule>
Categories: PHP

Sahil Ahlawat

I am a Sr. Web Developer passionate about blogging and teaching. When I am not coding or writing blogs, I prefer traveling (Which I like most). I am also doing a bit or research on Indian Startups now a days.

Leave a Reply

Your email address will not be published. Required fields are marked *