A
A
Alexey Batalov2019-03-19 18:37:17
htaccess
Alexey Batalov, 2019-03-19 18:37:17

How to correctly set up a redirect from http to https, without the get parameter?

Good day. With .htaccess for now, please help!
The site has moved to https.
.htaccess contains the following redirect
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Example:
Page site.ru/news - redirects to site.ru/index.php?q=news
although the site page is actually indexed https://site.ru/new
Tell me how to set up a redirect without "index.php?q="

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Valentin, 2019-03-19
@romanko_vn

RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R,L]

V
Viktor Taran, 2019-03-20
@shambler81

you must redirect BEFORE initializing the core of the engine
to and the engine should be responsible for returning 200 OK.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question