Welcome Guest, Not a member yet? Register   Sign In
Help with SSL and .htaccess please!
#1

[eluser]Oliver New[/eluser]
Hi,

I would like to have a couple of controllers on my site served via https - for example mysite.com/account and mysite.com/checkout.

My web server is capable of hosting both http and https files in the same web root so I'd like to take advantage of that rather than the alternative - which as I see it would be to have a separate https directory and therefore a separate install of CI in it.

So I guess this should be possible via mod_rewrite in the .htaccess file? I've looked around for a few examples but I'm getting nowhere. I'm using a pretty standard .htaccess at the moment:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|img|css|js|common_funcs\.js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

I'd be very grateful for any ideas!
#2

[eluser]Oliver New[/eluser]
OK, I think I may have solved this myself - here's what I did in case anyone else is interested:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|img|css|js|secure|common_funcs\.js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteRule ^secure/(.*)$ https://domain.com/secure/$1

So the important thing is to include the directory you want to serve over https in the pipe separted list of the RewriteCond, in this example I'm using a directory named 'secure'. Then it's just a matter of adding the second RewriteRule.

Edit - that URL shouldn't be a comment of course - it's just rendering that way...




Theme © iAndrew 2016 - Forum software by © MyBB