Welcome Guest, Not a member yet? Register   Sign In
Trailing slash causes issues
#1

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?
Reply
#2

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

You can see this StackOverflow answer.
Reply
#4

(This post was last modified: 06-22-2022, 02:57 AM by dgvirtual.)

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).
==

Donatas G.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB