WordPress knowledge sharing

How to jump the main domain name to the www domain name for the Hostinger virtual host website

When building a website, only one of the www domain name and the main domain name without www can be selected as the domain name for public access, and the other domain name can be redirected to 301. stay Hostinger virtual host station establishment According to the convention, the www domain name is used as the primary domain name (such as www.vpsss.net), and the domain name without www (vpsss.net) needs 301 redirection to the www domain name (www.vpsss.net).

If you buy the hosting virtual host advanced business package, you will get a free cloudflare network acceleration. Old Wei suggested that you redirect the domain name without www to the www domain name as 301, which has many benefits.

Hostinger virtual host black five maximum discount Long term operation of foreign trade website, suggested by Lao Wei Hostinger virtual host WordPress website cost performance optimization.
Foreign trade, B2C/C2C and other websites suggest registering domain names abroad. open Namesilo official website , enter and select in the search box, and then register. Remember to use the discount code to save money. Discount code click Course of domain name registration of foreign domain name provider Namesilo obtain.
Use the discount code candy to fold up.
Purchase of advanced virtual host for 12 months and above, free of charge One year COM domain name and free SSL certificate and Cloudflare.
About Hostinger: Hostinger topic

1. Set cloudflare DNS address

Click to log in to the host background Enter, if your interface is not Chinese, please switch in the upper right corner of the page, as shown in the following figure:

 Switch between Chinese and English in the upper right corner of the Hostinger page

Find [Domain Name]>cloudflare in the hpanel panel. If you are not familiar with the management background, please move to Hostinger virtual host management function explained in detail

As shown in the figure below, Cloudflare provides two "Domain Name Server" addresses.

Cloudflare takes up to 6 hours to become effective. If the service address status is checked in green, it means it has become effective.

 Cloudflare provides two "domain name server" addresses

For the cloudflare function of the host, please move to Hostinger One click Enable Cloudflare Acceleration Website Detailed Graphic Guide

Log in to the domain name management background of the domain name registrar. This article uses namesilo as an example.

Click to log in to the namesilo website , friends who have not registered the domain name of the foreign trade website can go to Foreign domain name provider Namesilo domain name registration tutorial and obtaining discount code

Click my account>domain manager at the top to enter the domain name management page.

  Namesilo Click my account>domain manager at the top to enter the domain name management page

After viewing the domain name list, check the domain name to be operated, and click the change nameservers button above the domain name list.

Then you see three lines of namesevers addresses, all of which are cleared and deleted.

Then copy and paste the two "Domain Name Server" addresses provided by Cloudflare above. Leave the third line blank and save it.

Wait for 5 minutes to take effect.

 Namesilo check the domain name, and then see the [change nameservers] button in the upper line

It takes up to 6 hours for Cloudflare SSL to start working.

2. Hoster One click deployment of SSL certificate

Because I shared How to add and set SSL certificate to Hostinger , so there is no wordiness here.

The SSL certificate took effect immediately at that time.

3. Hoster rapid station building

You can read How Hostinger can quickly create a WordPress website To quickly deploy the WordPress website.

4. Hoster setting 301 redirection

After building the site, enter [File Management Function]>[File Manager (beta)] in hpanel.

 Hoster enters [File Management Function]>[File Manager (beta)]

Double click the public_html directory. After entering, double click the. htaccess file to start editing.

 Host editing htaccess file

Under the following code

<IfModule mod_rewrite.c>
RewriteEngine On

Add the code in the following figure (take Weieis note domain name as an example):

RewriteCond %{HTTP_HOST} ^vpsss.net [NC]
RewriteRule ^(.*)$ https://www.vpsss.net/ $1 [L,R=301]

 Adding 301 redirect code to the host

The above codes must be strictly free of extra spaces, extra characters or missing characters, or they will not take effect.

5. Re login to WordPress website background

At this time, you need to log in to the website background again. Even if you have already logged in, you will automatically exit.

If there is no response after entering the account and password, please go to the hpanel panel [Database Functions]>[phpmyadmin], click the button on the right to enter database management, find wp_options, double-click and modify the domain names of the siteurl and home lines to www domain names. No matter what format the previous url is, it should be modified to https://www.vpsss.net This form.

If you used your domain name/wp login. php to log in, change it to your domain name/wp admin, and vice versa.

Open it with a domain name without www to see if it automatically jumps to the www domain name. At this point, the website background can be opened normally, and then the website foreground page can be checked without any problem. The hosting website does 301 redirect to the www domain name without the www domain name, which is a complete success.

Like( one )
Article name: How Hostinger Virtual Hosting Website Jumps the Main Domain Name to the www Domain Name
Article link: https://www.vpsss.net/28135.html
Copyright notice: The resources of this website are only for personal learning and exchange, and are not allowed to be reproduced and used for commercial purposes, otherwise, legal issues will be borne by yourself.
The copyright of the pictures belongs to their respective creators, and the picture watermark is for the purpose of preventing unscrupulous people from stealing the fruits of labor.