Chirag Lukhi
Chirag Lukhi

Reputation: 1546

Nginx server not working with trailing slash

I have setup Ubuntu 20.4 with Nginx.

All working fine except following

When someone hit https://www.example.com/webservice.php all working fine as expected.

but If tried to hit https://www.example.com/webservice.php/ then it gives 404 error. here, It just have extra slash at end.

I already tried to update Nginx default file as follow with rewrite rules rewrite ^/(.*)/$ /$1 permanent; However it redirect to webservice.php from webservice.php/

But it just result empty page while it rewriting it doesn't pass it request body there.

Please, any solution?

Upvotes: 0

Views: 1446

Answers (1)

Rob
Rob

Reputation: 15160

By adding the slash, you are saying it's a URI pointing at a directory and not the PHP file. There is no directory called webservice.php I presume. Only a file. Therefore, the 404 error. Don't do that.

Upvotes: 2

Related Questions