0

I am looking for an NGINX rule for my website. If the user lands on my website with a URL having index.php at the end I want to redirect them to a /404 URL with a 404 status code.

for eg
http://example.com/index.php => http://example.com/404
http://example.com/abcd/index.php => http://example.com/404
http://example.com/abcd/dcba/index.php => http://example.com/404

so far I have this but this doesn't work.

location ~ index\.php$ {
        return 404 https://$host/404;
    }
Aj Maurya
  • 101

0 Answers0