P
P
P4YK2021-10-10 00:50:27
Nginx
P4YK, 2021-10-10 00:50:27

How to assign a different index file in Nginx?

I can't figure out how to make another index file instead of index.php.
Example: when a user types in url: example.com, to be redirected to example.com/132.php, not example.com/index.php

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
Timur, 2021-10-10
@XAKEPEHOK

If you need to open by default not index, but `132.php`: https://nginx.org/en/docs/http/ngx_http_index_modu...

K
ky0, 2021-10-10
@ky0

"Pushing" to a page and defining index files are two different things. The first is done using a directive rewriteor in the page code, the second is done using index.
I also recommend that you familiarize yourself with try_files , it often becomes necessary to sequentially iterate through several url options.

S
Sergey Sokolov, 2021-10-10
@sergiks

Equal sign - so that this block works only when the root of the site is requested

location = / {
  index 132.php;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question