CakePHP Version: 3.6
I created a project with 3 route prefixes: admin, vendor and customer.
On my local machine it is working fine, all the prefixes are working fine. I moved my project to a remote Linux server and it was working fine at first. Once I added an SSL certificate and I access my website like this:
https://subdomain.myproject.com/vendor
It does not work. The browser keeps loading, and after some time it shows This site can’t be reached took too long to respond.
If I add a trailing slash it is working fine:
https://subdomain.myproject.com/vendor/
Other than the vendor prefix, the other prefixes are working fine as expected. Is it because CakePHP has a vendor folder or is it because of a server redirection?
Please guide me, how do I redirect http to https? I have added something to .htaccess, but it is also showing a 'too many redirects' issue.
If you have
mod_direnabled in Apache, it should by default automatically redirect your requests to the same URL with a trailing slash. From the Apache documentation:It's likely you do have this enabled, but check.
The vendor directory should not be publicly accessible in CakePHP, and I wouldn't expect there to be any issue with having a
vendorrouting prefix.Your .htaccess should look something like this, to force an HTTPS redirect and ensure CakePHP functions correctly: