Как настроить 404 ошибку для всех запросто?

Решил на лендинге сделать 404 ошибку.
site.com/index.php и site.com/index.html настроил что бы редиректили на site.com
site.com/ с 1 или более слешей на site.com
Как сделать что бы для всех других запросов мы попадали на 404.php?
server {        
        listen *:80;
        listen [::]:80;
        server_name site.com;
	
		access_log /var/www/vhosts/site.com/log/access.log combined;
		error_log /var/www/vhosts/site.com/log/error.log;

		rewrite_log on;
		rewrite ^/config.php/(.*)$ /config.php$1 last;

        root /var/www/vhosts/site.com/httpdocs;

        index index.php;
        include /etc/nginx/sites.conf.d/global.conf;

        location / {
            try_files $uri $uri/ /index.php?$args;
        }

        location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/run/php/php-fpm--site.com.sock;
        }

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

		if ($request_uri ~ ^[^?]*//) {
			rewrite ^ $uri permanent;
		}

		error_page 404 /404.php;
    }
  • Вопрос задан
  • 76 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы