The backend login address of my website is like this, www.example.com/login.php
But I want to hide the login address through Nginx and replace it with an uncommon login address, which becomes www.example .com/secretlogin.php. It also requires that access to login.php be prohibited.
My previous Nginx configuration was:
location ^~ /login.php {
return 403;
}
location ^~ /secretlogin.php {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
rewrite ^/secretlogin.php /login.php break;
}
But when I finally visited www.example.com/secretlogin.php, a 404 appeared.
I don’t know what the correct configuration should be.
rewrite ^/secretlogin.php.php /login.php break;
More .php
or just like this