Answer the question
In order to leave comments, you need to log in
How to translate Apache rewrite --> nginx?
Good afternoon, friends
It so happened that the admin is "on vacation" and I was strongly asked to move the project from apache to nginx. It seems to have coped with everything except 1 part related to rewrite rules.
So in the Apache config, it looks like this:
The RewriteRule itself is not very scary, the docks are in hand and went ... But the line RewriteCond %{ENV:REDIRECT_STATUS} ^$ causes me certain problems.
Khabrovites, do not let the abyss :)
Thank you in advance
<IfModule mod_rewrite.c>
RewriteEngine On
#Article images rules
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^minsk_anons/[a-z0-9\_\-]+\.(jpg|gif|png)$ /834a74fe95a05a05a95d7cfaec9cc494.php [L]
#Articles rules
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^minsk_anons/[0-9]{2,4}[0-9]{1,2}[0-9]{1,2}_([0-9]+)\.html$ /834a74fe95a05a05a95d7cfaec9cc494.php [L]
Answer the question
In order to leave comments, you need to log in
Just ignore them. They are there in order not to run these rules again (due to the logic of how mod_rewrite works). In nginx, you don’t need to do rewrites at all, but write it right away with locations.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question