Home From http to https - htaccess and URL rewrite - Too many redirect error
Reply: 0

From http to https - htaccess and URL rewrite - Too many redirect error

user910
1#
user910 Published in June 20, 2018, 1:22 am

I have a site with the following working code in .htaccess to get friendly URLs:

RewriteEngine On
RewriteRule ^([^_]*)_([^_]*)\.html$ /?s=scheda&id=$1&slug=$2 [L]
RewriteRule ^([^/]*)\.html$ /?s=$1 [L]

Since I installed a SSL certificate, I need to update my .htaccess to redirect http contents to https. I found this code:

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

And I tried to add it to my .htaccess:

RewriteEngine On
RewriteRule ^([^_]*)_([^_]*)\.html$ /?s=scheda&id=$1&slug=$2 [L]
RewriteRule ^([^/]*)\.html$ /?s=$1 [L]

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

but I get a "Too many redirect problem" error.

What's wrong?

Thanks a lot.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.3589 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO