I've tried almost all, if not all, the results I could find, to implement a redirect from http://xyz.com to https://xyz.com, and all ended in failure, with an "Internal loop redirect error" message. Any tips on how to achieve this redirect? This is my actual configuration for the site: domain: xyz.com auto-subdomain: www. ssl: CHECK php: php-fpm redirect: SEO Redirect - www to non-www custom nginx directives Code: location / { try_files $uri $uri/ /index.php?/$request_uri; rewrite ^/(en|es|ro)/(.*)$ /$2 permanent; } Any help, would be much appreciated.
Try following. Code: server { listen 80; server_name my.domain.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl; server_name my.domain.com; [....] }
Using apache2, this is how it's done with phpMyAdmin: In apache2/conf-available, there is a symlink to the phpMyAdmin config file (/etc/phpmyadmin/apache.conf). In apache2/conf-enabled (because phpMyAdmin is enabled), there is a symlink back into conf-available. (This probably doesn't matter for your question, but I thought I would include it anyway for others.) In the apache.conf file, it has, at the very top: Code: <IfModule mod_rewrite.c> <IfModule mod_ssl.c> <Location /phpmyadmin> RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} </Location> </IfModule> </IfModule> So, it's not actually redirecting, but rather using a rewrite rule. When I try to access phpMyAdmin using http, the request is converted to https. I'm not using NGINX on my server, but hope this helps anyway. Cheers, Nap
I use this for nginx: Code: if ($scheme != "https") { rewrite ^ https://xyz.com$request_uri? permanent; }
The above works, you can see that here at howtoforge when you try to use the site without https. You will get a redirect loop when you use: if ($scheme != "https") { rewrite ^ https://www.xyz.com$request_uri? permanent; } instead of the one I posted above. Another possibility is that the vms or shop that you use in your website redirects back to http and therefor causes this loop.
I suspected a rewrite was needed and thought I would post how I've done it, in case NGINX was similar.
Thanks for trying to help Nap, but it's slightly different. Til, I was aware of the www. but, it still doesn't work. Same issue. I just don't know where else to look... so confusing
Ok, I got the issue fixed. It was because my Cloudflare SSL setting was set to Flexible SSL and I've changed it for Strict SSL and I've added this nginx rule to my domain: Code: if ($http_x_forwarded_proto = "http") { return 301 https://$server_name$request_uri; }