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 %{REQUEST_URI} !^/exchange_1С_Opencart.php$ RewriteCond %{REQUEST_URI} !^/TEMP$ RewriteRule ^(.)$ https://%{HTTP_HOST}/$1 [R=301,L] RewriteCond %{HTTP:X-HTTPS} 1 [NC] RewriteCond %{REQUEST_URI} ^/exchange_1С_Opencart.php$ RewriteCond %{REQUEST_URI} ^/TEMP$ RewriteRule ^(.)$ http://%{HTTP_HOST}/$1 [R=301,L] 2 variant
RewriteEngine On RewriteBase / RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} !^/exchange_1С_Opencart.php$ [NC] RewriteCond %{REQUEST_URI} !^/TEMP$ [NC] RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L,QSA] RewriteCond %{SERVER_PORT} 443 RewriteRule ^(/exchange_1С_Opencart.php)$ http://%{HTTP_HOST}/$1 [R=301,L,QSA] RewriteRule ^(/TEMP)$ http://%{HTTP_HOST}/$1 [R=301,L,QSA]
This textbox defaults to using Markdown to format your 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.
@mianofv Wow, that’s a difficult config to read - specially if you’re new to Nginx, so I understand why you can’t figure it out.
Instead of trying to hack around with http vs https, maybe we should simply look at
exchange_1С_Opencart.php
file and see why it doesn’t work with https (because it should work without any problems, since you’re already redirecting http to https). Can you contact the developer to get it fixed?Otherwise, you need to not use the CentMinMod wizard anymore, since it might overwrite some of the changes you’re going to make. It’s a little difficult to figure out the configuration, since there’s so many includes. This might work - but it might “explode”, so make a copy of
domain.com.ssl.conf
before replacing with this. Remember to replace all thedomain.com
with the correct domain.Are you’ve change the configuration, then you need to test the config and restart Nginx:
Thanks! Module is connecting. But not uploading the files… I guess only a developer of that module can fix that.
Thank you for your answers. I have a program installed on my computer in my shop which synchronizes products to my OpenCart . My OpenCart is with HTTPS, but that OpenCart module works only with HTTP. So I need to force those files to redirect to HTTP only. The developer only gave Apache rules.