A
A
Alexey Denisov2020-04-25 18:17:46
Nginx
Alexey Denisov, 2020-04-25 18:17:46

Why doesn't location work?

Please tell me how to set up such a location, this example does not work.
When typing the address
http://sites/mail
In the address bar of the browser, the path changes to sites/mail, but index.php does not start,
writes File not found .
If you just type the address, then index.php from /var/www/html works

server{	
  ...	
  root /var/www/html;
  index index.php;
  
  location  /mail {	
  return 301 http://sites/mail;
  }
    
  location / {
    rewrite ^/([^\.]+)$ /$1.php ;
  }
}


There are two directories (two sites: html and mail) and each has an index.php, what is the correct way to run index.php from the mail directory?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2020-04-26
@ky0

location  /mail {	
  return 301 http://sites/mail;
  }

And what do you think this location should do? When they go to /mail, again send to /mail?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question