Welcome Guest, Not a member yet? Register   Sign In
SSL in CodeIgnitor
#11

[eluser]got 2 doodle[/eluser]
Quote:$_SERVER[‘HTTPS’].
Yes this seems like a sane approach
Quote:2)Instead of essentially duplicating the base_url(), site_url(), and redirect() just to add an “s” to “http”, override them to add an optional “protocol” parameter. I won’t comment on anchor() or form_open() since I don’t use them.
This works when the url is essentially the same but in the case of a shared ssl certificate the url gets considerably more complicated. Or at least that was the case with my hosting service.
Quote:There shouldn’t be a need for a “secure_base_url” config value.
as above, I agree in the case of dedicated ssl certificate.

@rick jolly - thanks for your comments and an alternative approach

@rbdc - I'm glad you found my post useful

@everyone else - Note that this is my first venture into SSL, take my post with that knowledge in mind. I simply wanted to document my discoveries and subsequent solutions.

The site that this is running on now is performing as desired - visit the site here if you want to see it in action.
#12

[eluser]Jonny Noog[/eluser]
Hello,

I've just installed a self-signed SSL certificate for my website (to be used for non-public admin purposes only) and I'm having some trouble getting CI to work with the https URLs. I think it has something to do with my mod_rewrite rules that I'm using to remove the index.php part of the URL. Some testing reveals:

http://www.mydomain.com/controller/function - standard URL, works as expected

https://www.mydomain.com/index.php/controller/function - secure URL with the index.php included, works as expected

https://www.mydomain.com/controller/function - secure URL without the index.php, does not work, returns a 404 error, and this is my problem

My rewrite rules:

Code:
RewriteCond $1 !^(\/css|\/pages)
RewriteRule ^(.*)$ /index.php$1 [L]

I'm not very experienced with mod_rewrite, can anyone give me some tips on how I might be able to modify my rules to allow hiding of the index.php with a https URL?

EDIT: In fact there was nothing wrong with my rewrite rules. I just didn't realise that there is a separate apache virtual host block for the SSL version of my host and my configuration did not exist in this other virtual host block. So the problem was that it wasn't picking up any of my rewrite config at all. Added the same rewrite config to the relevant virtual host and now all is working. Time to go home. Smile
#13

[eluser]manisha[/eluser]
Hello Jonny,

I have added the rewrite rules in my relevant virtual host file...Now the code igniter screen does get displayed but without CSS, JS and images included in it.

Do you have any Idea why is this so?

I would be greatful if you share your knowledge with me to resolve my issue with htaccess rewrite rule and corresponding problem due to it..


Thanks
#14

[eluser]Jonny Noog[/eluser]
[quote author="manisha" date="1296765070"]Hello Jonny,

I have added the rewrite rules in my relevant virtual host file...Now the code igniter screen does get displayed but without CSS, JS and images included in it.

Do you have any Idea why is this so?

I would be greatful if you share your knowledge with me to resolve my issue with htaccess rewrite rule and corresponding problem due to it..


Thanks[/quote]

Hello manisha,

It sounds to me like you might just have not properly excluded your css, js and images directories. But it's hard to know without looking more closely at your set up. Perhaps you could be more specific. Do you have root access to the machine you're working on or are you in a shared hosting environment? Are you placing your rewrite rules in a .htaccess file or are you placing them in a virtual host block (you mention both)? Are you using HTTPS like I was? Can you post the content of the relevant files?
#15

[eluser]manisha[/eluser]
Hello Jonny,
Thanks for your reply.

Yes, I have used the rewrite rules in .htaccess file and in Virtual Host file too.
Initially I was trying all different rules in .htaccess file only... But nothing worked for me. Then I tried writing the rule in Virtual host file.. and the URL worked for https for Code igniter. Currently, I have tried this on my local machine. I need to try it on Live server(Dedicated Sever[Linux]).




Theme © iAndrew 2016 - Forum software by © MyBB