CodeIgniter Forums
Trailing slash causes issues - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Trailing slash causes issues (/showthread.php?tid=76477)



Trailing slash causes issues - kick - 05-15-2020

I'm not sure if this is my setup or if this is a bug however I figured I would report it.

When entering a URL in CI 4 with a trailing slash (i.e. localhost/my-site/public/index.php/ ) the page jumps to my htdocs folder index.php for my XAMPP server. It does it whether the url is as above or with a route call. Any time there is a trailing slash.

Anyone else come across this while testing their code?


RE: Trailing slash causes issues - ilFaber - 06-24-2020

The same happens to me.
With CI3 I didn't have this issue.


RE: Trailing slash causes issues - sammyskills - 12-12-2020

You can see this StackOverflow answer.


RE: Trailing slash causes issues - dgvirtual - 06-22-2022

I noticed I also had the issue of the .htaccess rule for removing trailing slashes (redirection) ignoring the fact that my app is in a subdirectory, so it would redirect mydomain.com/myapp/mypage/ to mydomain.com/mypage/  instead of the address without the trailing slash only (mydomain.com/myapp/mypage). It was a problem in the early CI4 .htaccess file code (pre 20 Jul 2020 code, see the committ solving the issue[url=https://github.com/codeigniter4/CodeIgniter4/commit/73a774500b0548cd0303ec037681e3d31355ef4e][/url]). So, the current code of Codeigniter 4, which contains the default .htaccess file, has that issue solved.

Moreover, when checking if the changed rules work, you have to use another browser / anonymous session, because the previous rules made the browser cache the bad redirection (I might not be using the exactly technically correct language here, but hope you get what I mean).