About redirecting to https.

Asked 2 years ago, Updated 2 years ago, 133 views

I am a beginner in web production.It may not be programming, but I'm having trouble and I don't know if you know anything about it.

Currently, I set up my own SSL on the server of Lollipop, and although I have acquired the https site, it is still the http site that appears in the search.I'd like to unify this into https, but how can I do it?The word "redirect" appeared, but I don't understand it well.The website is created in HTML (not wordpress).

I'm sorry to trouble you, but I appreciate your cooperation.

ssl .htaccess https

2022-09-29 21:35

3 Answers

About Redirect

HTTP is a "server & client method" system in which the client requests the server and the server responds.Due to the nature of this method, the server cannot control what requests the client makes.

In this example, the client web browser should use https:// instead of http://, but it is up to the browser to decide which one to access, so the server cannot control it.

This is a problem, so HTTP provides a mechanism called redirect.This tells the browser the next URL to access when the server responds.The browser then accesses the specified URL.

In this example, if http:// has access and the server responds with a redirect to https://, the client connects to https://, which is how the server directs requests from the client.

There are permanent and temporary redirects for redirects, but permanent is used when the site moves and the URL changes.The search site indexes permanent redirect destinations, so you can expect the URL https:// to be searched if you configure the redirect settings correctly.

How to Configure

You can configure redirect using the .htaccess file.

Edit the .htaccess file in a text editor and store it on the server as if it were html or something like this:

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

If you access it with http:// in your browser, the URL field automatically switches to https://, and you succeed.


2022-09-29 21:35

"How about the procedure described in the ""Redirect from http to https"" column on the website below?"
 I haven't signed up for a server for Lollipop, so I haven't been able to try it, but I think it's probably okay.

https://1bocci.com/lolipophttps


2022-09-29 21:35

A non-dependent method of configuring rental servers is to use Javascript to redirect to HTTPS if the protocol is HTTP.

Automatically redirects by loading a script similar to the following:

 if(location.protocol==='http:'){
    location.href='https:'+window.location.href.substring(window.location.protocol.length);
}


2022-09-29 21:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.