Answer the question
In order to leave comments, you need to log in
How to set up a redirect for the main page?
Hello!
You need to set up a 301 redirect for the Home page so that when you enter the following addresses, not only the redirect is carried out, but the code 301 is also given:
from
https://www.mysite.ru/ - now for this view, there is a redirect, but it gives the code 200
https: //www.mysite.ru/?
at
https://www.mysite.ru
Thank you in advance for your help.
Answer the question
In order to leave comments, you need to log in
As I understand it, %{QUERY_STRING}
requests ending in a single question mark cannot be distinguished from those without it, but you can use the variable %{THE_REQUEST}
containing the full request (see httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rew.. . ):
RewriteCond %{THE_REQUEST} ^\S+\s+/\?\s
RewriteRule "" http://example.com/? [R=301,L]
http://example.com/
and http://example.com
, the second address is converted by the browser to the first one and the server receives an indistinguishable request, so there is nothing to redirect.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question