Question
.htaccess config to Nginx?
I am trying to change those Apache rewrite rules to Nginx, but auto converter fails. And I am not very good at them. Can anyone help please?
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP:X-HTTPS} !1
RewriteCond %{REQUESTURI} !^/exchange1СOpencart.php$
RewriteCond %{REQUESTURI} !^/TEMP$
RewriteRule ^(.)$ https://%{HTTPHOST}/$1 [R=301,L]
RewriteCond %{HTTP:X-HTTPS} 1 [NC]
RewriteCond %{REQUESTURI} ^/exchange1СOpencart.php$
RewriteCond %{REQUEST_URI} ^/TEMP$
RewriteRule ^(.)$ http://%{HTTP_HOST}/$1 [R=301,L]
2 variant
RewriteEngine On
RewriteBase /
RewriteCond %{SERVERPORT} 80
RewriteCond %{REQUESTURI} !^/exchange1СOpencart.php$ [NC]
RewriteCond %{REQUESTURI} !^/TEMP$ [NC]
RewriteRule ^(.*)$ https://%{HTTPHOST}/$1 [R=301,L,QSA]
RewriteCond %{SERVERPORT} 443
RewriteRule ^(/exchange1СOpencart.php)$ http://%{HTTPHOST}/$1 [R=301,L,QSA]
RewriteRule ^(/TEMP)$ http://%{HTTP_HOST}/$1 [R=301,L,QSA]
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.
×
@mianofv
You may also want to take a look at this post, which has rewrites for NGINX. I don’t know for sure if they work with the latest version of OpenCart, though of all the posts I’ve looked at so far, they seem to be pretty consistent.
https://isenselabs.com/posts/how-to-install-and-run-opencart-on-nginx-server