0

For Laravel project I want urls starting with index.php to return 404.

Currently i have a laravel project. i want to ignore index.php in the url.

For example: If url domain.com/index.php -> 404 If url domain.com/index.php/page -> 404

Because there is no route defined for index.php. Right now, when user enter domain.com/index.php or domain.com/index.php/page user see the pages. (When index.php is written to the url, I want it to search as if it were a route.)

I want to see 404 page for /index.php and /index.php/* routes. I use nginx and I am looking solution for nginx.

  • _"Because there is no route defined for index.php. Right now, when user enter domain.com/index.php or domain.com/index.php/page user see the pages."_ - of course; it's an actually existing file, so it does not _need_ any route. Routes are for URLs the web server can _not_ find a match for in the file system. You should probably handle this on the URL rewriting level. – CBroe Feb 23 '23 at 13:08
  • Sure, i am looking solution for nginx configuration file. – Bunyamin Kurt Feb 23 '23 at 13:10
  • "nginx rewrite url to 404" typed into Google, first result: https://stackoverflow.com/questions/4664872/configuring-nginx-to-return-a-404-when-a-url-matches-a-pattern – CBroe Feb 23 '23 at 13:16

0 Answers0