V
V
Vladimir2016-09-20 16:26:51
Nginx
Vladimir, 2016-09-20 16:26:51

nginx rewrite like apache?

Previously, the site was running on Apache, and there were paths everywhere:
example.org/index (the request went to example.org/index.php)
example.org/admin (the request went to example.org/admin.php)
example.org/profile (the request went to example.org/profile.php)
Apache automatically processed the path data, and quietly opened.
After transferring to Nginx, the paths of such a plan are not acceptable for him, and climbing to add *.php everywhere is dreary and unrealistic.
How can I make Nginx behave the way it did out of the box with Apache rewrite enabled?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
littleguga, 2016-09-20
@qDiablo

Choose any convenient option:
stackoverflow.com/questions/21911297/how-to-remove...
stackoverflow.com/questions/36383539/remove-php-ex...
stackoverflow.com/questions/19975218/remove-php-fr ...
https://www.digitalocean.com/community/questions/n...

A
Andrey Minisol, 2016-09-20
@AmadeyMinisol

Maybe https://winginx.com/ru/htaccess will help you if the rules are not tricky

M
Maxim, 2016-09-20
@pudovMaxim

I'm not sure, but something like this might help:

location / {
        try_files $uri $uri.php /index.php$is_args$args;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question