Redirect doesn't work with SSL |
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?
(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.
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.
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
04-14-2017, 02:30 AM
(This post was last modified: 04-14-2017, 02:32 AM by InsiteFX. Edit Reason: add for changes )
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. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
@ghost13: apache has a documentation
https://httpd.apache.org/docs/2.4/en/mod...owoverride http://httpd.apache.org/docs/current/mod...write.html http://httpd.apache.org/docs/current/mod...l#Override Quote:Only available in <Directory> sections |
Welcome Guest, Not a member yet? Register Sign In |