C
C
criminalist2018-11-30 14:52:34
Nginx
criminalist, 2018-11-30 14:52:34

How to hide index.php using nginx?

Hello, I can’t solve the issue with NGINX and url, I got rid of Apache, in it such a construction worked,
for example url: /?classid=4 (works in Apache, nginx does not work)
In fact, this is: /index.php?classid=4 ( works in apache and nginx)
I’ll say in advance that no one will install apache, the issue is solved only with the help of nginx, or by editing the source code of the engine.
In general, how can I make nginx understand that it needs a call to index.php if it was slipped /? classid
And is it possible to do this with regular expressions?
It will take too long to edit the sources, so I'm looking for an option with nginx, it turned out to be difficult for me to formulate a request in Google, I decided to ask.
The search continues, any answer will be grateful.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Danil Sapegin, 2018-11-30
@ynblpb_spb

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

C
criminalist, 2018-11-30
@criminalist

Thank you kind person, now I’ll try to check everything 10 times, but this design is registered in the virtual host config, but it doesn’t work out.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question