U
U
UnrealNatural2016-01-14 21:18:50
PHP
UnrealNatural, 2016-01-14 21:18:50

http redirect to https htaccess?

Good afternoon. There is a site. It has an htaccess file. There was this code:

AddDefaultCharset UTF-8
RewriteEngine On
RewriteRule ^([A-Za-z0-9-/]+)$ /index.php?page=$1 [L]

With the help of these commands, I get a site.ru/page=game redirect to site.ru/game
I put an SSL certificate on the site and redirect http to https is
required I rummaged through the internet and found this code:
RewriteEngine On
RewriteCond %{HTTPS} =off 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L]

Everything works great.
But now we need to combine it:
RewriteEngine On
RewriteCond %{HTTPS} =off 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L]
RewriteRule ^([A-Za-z0-9-/]+)$ /index.php?page=$1 [L]

It doesn't work( Loop forward...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
romy4, 2016-01-14
@romy4

because you need to redirect [R] where https, not [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question