0

The current code in .htacess is

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

Its build-in codeigniter, base URL in codeigniter has been changed to https after installing SSL. now if we are accessing with https://mywebsite.com we can access https secured website but f we are accessing with http://mywebsite.com we can't access https secured website. My requirement is that I need to redirect HTTP to https. i found may article but due to my lack in the knowledge it's not working

Sancy Devassy
  • 11
  • 1
  • 6

2 Answers2

1

Try this:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
nologin
  • 1,402
  • 8
  • 15
0

put this on your config.php

$config['base_url']  =  "https://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= preg_replace('@/+$@', '', dirname($_SERVER['SCRIPT_NAME'])).'/';
RedHat5
  • 30
  • 5