It is not possible to make a redirect to the main one in nginx view links

/watchh/a./asdww/index.php /video/test/index.php /index.php 

should redirect to home

    1 answer 1

    If you want with /Index.php on / then so.

     server { ... if ($request_uri ~ "^(.*)index\.(?:php|html)") { return 301 $1; } } 

    Or so

     location ~ ^/index.(html|php)$ { if ($request_uri ~ ^/index.(html|php)) { rewrite ^.*$ / permanent; } } 

    But then requests for /index.html and /index.php will give 301 redirects to the root of the site, and the site itself will work as before.