A
A
Alexander Andreev2019-04-15 11:08:58
Nginx
Alexander Andreev, 2019-04-15 11:08:58

How to configure nginx to open a php file when accessing txt?

How to request log.php when accessing /log.txt? On apache, this was solved by a similar rule in .htaccess:

RewriteEngine On
RewriteRule ^log\.txt$ /log.php [L]

how to implement the same rule for nginx + php-fpm?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Mezhuev, 2019-04-15
@maler1988

Absolutely the same:

location / {
    rewrite ^/log\.txt$ /log.php;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question