http to https using .htaccess |
[eluser]Unknown[/eluser]
I was bogged down with this problem a couple of weeks ago, I had to rewrite a couple of urls to https. The rest of the url should be on http, that means if they are on https they should be written to http. I couldnt get the solutions easily, so I m posting it here. --------------------------- first of all you need to change your base url to Code: $config['base_url'] = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') ? 'https://' : 'http://' ; with this for a https page all the links created with base_url() will automatically be https. --------------------------- Secondly, you need the following entry to ur .htaccess file, tweak it as per the requirement Code: RewriteCond %{HTTPS} !on the condition RewriteCond %{HTTP_REFERER} !^https(.*)/(view|checkout|pay)(.*)$ [NC] doesnt rewrite the links to http which are on a https page. ------------------------------------------------------- you can go through this stackoverflow link for a little more details http://stackoverflow.com/questions/18188...ps-to-http Hope this helps someone .. regds, Shikhar |
Welcome Guest, Not a member yet? Register Sign In |