![]() |
Redirect doesn't work with SSL - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Redirect doesn't work with SSL (/showthread.php?tid=67801) |
Redirect doesn't work with SSL - ghost13 - 04-11-2017 We have a basic website built with CodeIgniter. There are 4 pages altogether. We recently moved to SSL certificate and the website doesn't redirect properly in .htaccess we have the standard directives to access pages without /index.php/ Code: RewriteEngine on Since we moved to https all links stopped working eg. www.example.com/home doesn't work anymore. But if you access the page with www.example.com/index.php/home it works!!! Is there anything else I need to write in the htaccess file? Or any other way to fix the redirects? RE: Redirect doesn't work with SSL - Paradinight - 04-11-2017 (04-11-2017, 05:33 AM)ghost13 Wrote: We have a basic website built with CodeIgniter. There are 4 pages altogether. We recently moved to SSL certificate and the website doesn't redirect properly The virtualhost config is wrong. the config of you https is missing an AllowOverride. RE: Redirect doesn't work with SSL - dave friend - 04-11-2017 Did you edit config.php and put the "https: in base_url? RE: Redirect doesn't work with SSL - ghost13 - 04-13-2017 I change https in base_url config.php but still no change. I don't know where to put this AllowOverride and what is the correct syntax Currently in our ssl.config file I have #<VirtualHost *:80> #DocumentRoot /path/to/site/ #ServerName www.example.com #Redirect permanent / https://www.example.com/ #</VirtualHost> #<VirtualHost *:443> #DocumentRoot /path/to/site/ #ServerName www.example.com #SSLEngine on #SSLCertificateFile /root/www_example_com.crt #SSLCertificateKeyFile /root/www_example_com.key #SSLCertificateChainFile /root/certificate.crt #</VirtualHost> Lines are commented because otherwise this website redirects to out other website. RE: Redirect doesn't work with SSL - dave friend - 04-13-2017 I think your RewriteRule is malformed. Change Code: RewriteRule .* index.php/$0 [PT,L] Code: RewriteRule ^(.*)$ index.php/$1 [L] I don't think the PT flag was of any benefit and I removed it. There is a very handy htaccess tester at http://htaccess.mwl.be/ Given a test URL of http://example.com/controller that site outputs http://example.com/index.php/controllerindex.php/ With my rule the output is http://example.com/index.php/controller RE: Redirect doesn't work with SSL - InsiteFX - 04-14-2017 You can add it to vhosts like this: Code: # CI 3.1.4 Dev CSD Testing You will want to change some of these for a live web server, this is for a localhost. Or in your .htaccess like this: Code: AllowOverride All hope this helps you out. RE: Redirect doesn't work with SSL - ghost13 - 04-25-2017 (04-14-2017, 02:30 AM)InsiteFX Wrote: Yes thank you InsiteFX, that did the trick. I just needed to add it to the <VirtualHost *:80> RE: Redirect doesn't work with SSL - Paradinight - 04-25-2017 @ghost13: apache has a documentation https://httpd.apache.org/docs/2.4/en/mod/core.html#allowoverride http://httpd.apache.org/docs/current/mod/mod_rewrite.html http://httpd.apache.org/docs/current/mod/directive-dict.html#Override Quote:Only available in <Directory> sections |