Reputation: 91
I am trying to setup SSL on my codeigniter site, but I'm running into a few problems.
Codeigniter refuses to access https://. Firefox displays this error:
The page isn't redirecting properly. Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
My config file has this as the base_url
$config['base_url'] = "http".((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "")."://".$_SERVER['HTTP_HOST'].str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
My .htaccess file is as follows:
RewriteEngine on
RewriteCond $1 !^(index\.php|first_cut|media|robots\.txt|user_guide|xd_receiver\.htm|channel.php)
RewriteRule ^(.*)$ /index.php/$1 [L]
Ideally I would like https:// to always be applied to these folders...
... and then optional https for the rest of the site
Any ideas?
Upvotes: 0
Views: 1330
Reputation:
Kindly try this code
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ http://www.projectname.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.projectname.com/$1 [R=301,L]
#search folder and redirect to subdomain
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} dimentions
RewriteRule ^(.*)$ https://www.projectname.com/$1 [R,L]
Upvotes: 2
Reputation: 31088
It seems you only want to redirect files that do not exist to index.php
. There's an easier way for that:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ /index.php/$1 [L]
Upvotes: 0