Question

Convert rewrite rule apache2 to nginx

RewriteEngine on

RewriteBase / RewriteCond %{HTTP_HOST} ^www.(.)$ [NC] RewriteRule ^(.)$ http://%1/$1 [R=301,L]

RedirectMatch 301 ^/o-kompanii/?$ /company RedirectMatch 301 ^/shvejnoe-proizvodstvo/?$ /studio RedirectMatch 301 ^/novosti/?$ /news RedirectMatch 301 ^/kontakty/?$ /contacts RedirectMatch 301 ^/vyshivka-logotipa/?$ /studio RedirectMatch 301 ^/otzyvy/?$ /reviews RedirectMatch 301 ^/vopros-otvet/?$ /faq RedirectMatch 301 ^/bonus/?$ / RedirectMatch 301 ^/mobile(.*)$ $1

redirectMatch 301 ^/katalog/?$ /

RedirectMatch 301 ^/katalog/postelnoe-bele-satin /Postelnoe-bele-satin RedirectMatch 301 ^/katalog/prostyni /Prostyni RedirectMatch 301 ^/katalog/trikotazhnye-izdeliya /Trikotazhnye-izdeliya RedirectMatch 301 ^/katalog/nosovye-platki-skaterti /Nosovye-platki–Skaterti RedirectMatch 301 ^/katalog/podarochnye-nabory-komplekty-polotenec /Podarochnye-nabory RedirectMatch 301 ^/katalog/tkan /Tkan-maxrovaya

RedirectMatch 301 ^/katalog/makhrovye-polotentca /Maxrovye-polotenca RedirectMatch 301 ^/katalog/nabory-dlya-sauny /Vse-dlya-bani-i-sauny RedirectMatch 301 ^/katalog/nakidki/polotentse-nakidka-makhrovaya-na-lipuchke-zhenskaya /Maxrovye-polotenca RedirectMatch 301 ^/katalog/polotentsa-dlya-kukhni /Maxrovye-polotenca

RedirectMatch 301 ^/katalog/sauna /Vse-dlya-bani-i-sauny#/menu?orderBy=sort&filters={“68”:[735]} RedirectMatch 301 ^/katalog/nakidki /Vse-dlya-bani-i-sauny#/menu?orderBy=sort&filters={“68”:[736]} RedirectMatch 301 ^/katalog/rukavitsy /Vse-dlya-bani-i-sauny#/menu?orderBy=sort&filters={“68”:[737]} RedirectMatch 301 ^/katalog/chalma /Vse-dlya-bani-i-sauny#/menu?orderBy=sort&filters={“68”:[738]} RedirectMatch 301 ^/katalog/tapki /Vse-dlya-bani-i-sauny#/menu?orderBy=sort&filters={“68”:[739]}

RedirectMatch 301 ^/katalog/polotentsa-rossiya-donetskaya-manufaktura /Maxrovye-polotenca#?filters={“2”:[620]}&orderBy=sort RedirectMatch 301 ^/katalog/polotentsa-rossiya-krasnye-tkachi /Maxrovye-polotenca#?orderBy=sort&filters={“2”:[593]} RedirectMatch 301 ^/katalog/polotenca-kitaj /Maxrovye-polotenca#?orderBy=sort&filters={“2”:[76]} RedirectMatch 301 ^/katalog/turtsiya /Maxrovye-polotenca#?orderBy=sort&filters={“2”:[116]} RedirectMatch 301 ^/katalog/turkmeniya /Maxrovye-polotenca#?orderBy=sort&filters={“2”:[119]} RedirectMatch 301 ^/katalog/polotentsa-uzbekistan /Maxrovye-polotenca#?orderBy=sort&filters={“2”:[472]} RedirectMatch 301 ^/katalog/vse-dlya-kukhni /Maxrovye-polotenca#/menu?filters={“72”:[771]}&orderBy=sort

RedirectMatch 301 ^/katalog/imena /Polotenca-s-vyshivkoy#?orderBy=sort&filters={“63”:[719]} RedirectMatch 301 ^/katalog/goroskopy /Polotenca-s-vyshivkoy#?orderBy=sort&filters={“63”:[723]} RedirectMatch 301 ^/katalog/tsvety /Polotenca-s-vyshivkoy RedirectMatch 301 ^/katalog/god-petukha-2017 /Polotenca-s-vyshivkoy RedirectMatch 301 ^/katalog/23-fevralya /Polotenca-s-vyshivkoy RedirectMatch 301 ^/katalog/14-fevralya /Polotenca-s-vyshivkoy RedirectMatch 301 ^/katalog/8-marta /Polotenca-s-vyshivkoy RedirectMatch 301 ^/katalog/paskha /Polotenca-s-vyshivkoy RedirectMatch 301 ^/katalog/novyy-god /Polotenca-s-vyshivkoy RedirectMatch 301 ^/katalog/s-kartinkoy /Polotenca-s-vyshivkoy#?orderBy=sort&filters={“63”:[720]}

RedirectMatch 301 ^/katalog/vafelnye-khalaty /Vafelnye-xalaty RedirectMatch 301 ^/katalog/muzhskie-vafelnye-khalaty /Vafelnye-xalaty#?orderBy=sort&filters={“71”:[744]} RedirectMatch 301 ^/katalog/zhenskie-vafelnye-khalaty /Vafelnye-xalaty#?orderBy=sort&filters={“71”:[745]}

RedirectMatch 301 ^/katalog/muzhskie-khalaty /Maxrovye-xalaty#?orderBy=sort&filters={“57”:[703]} RedirectMatch 301 ^/katalog/zhenskie-khalaty /Maxrovye-xalaty#?orderBy=sort&filters={“57”:[704]} RedirectMatch 301 ^/katalog/detskie-khalaty /Maxrovye-xalaty#?orderBy=sort&filters={“57”:[705]}

RewriteCond %{REQUEST_URI} !? RewriteCond %{REQUEST_URI} !& RewriteCond %{REQUEST_URI} != RewriteCond %{REQUEST_URI} !. RewriteCond %{REQUEST_URI} ![^/]$ RewriteRule ^(.*)/$ /$1 [R=301,L]

if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d

otherwise forward it to index.php

RewriteRule . index.php

Subscribe
Share

Help me pls)


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

check the following link. i found it very useful

http://winginx.com/en/htaccess