T
T
TechNOIR2019-04-23 15:25:43
Nginx
TechNOIR, 2019-04-23 15:25:43

nginx. Any text after a slash in the address does not redirect to the main page. How to fix?

Good afternoon.
Raised a landing page on nginx.
All OK. But if we allow to write in the address site.com/fwefs0-fs-9dfusd9 and go, then this bilibird remains in the address. But I would like to have a redirect to the main page in case of this.
Config:

server {
    listen 80;
    server_name site.com;
  
      location / {
        root   /var/www/site.com;
        index  index.php;
      try_files $uri =503;
    }
     location ~ \.php$ {
        set $root_path /var/www/site.com;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_param SCRIPT_FILENAME $root_path$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_param DOCUMENT_ROOT $root_path;
    }
  error_page 503 /index.php;
    
}

What did I incorrectly specify in the config?
thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2019-04-23
@UPSA

I'm not an expert ....)))
It seems to me that the reaction should be on a non-existent page
error_page 404 /index.php;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question