Get the App
SLTechnology News&Howtos  ›  Servers  › 

How does the virtual host do 301 redirection

Shulou Source: shulou.com Published: 2022-06-02 01:52:27 10月03日 Update

What this article shares with you is about how the virtual host does 301 redirection. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it.

301Jump refers to the permanent redirection of the page to ensure that traffic is transferred to the latest version of URL.

Jump is a kind of http return code, the so-called http return code is to tell users and search engines the status of the URL currently visited. 301 means that the current page has been permanently transferred, which means that the previous link to the old page should be updated to the jump page address.

In addition to using 301 when moving old pages to new pages, 301 has many other application scenarios, such as switching to a new domain name to clean up dynamic URL, switching to a shorter and more friendly version to prevent content duplication, and so on.

How to set 301 jump for virtual host

In most cases, the jump can be set by modifying the server-side .htaccess file. .htaccess is a simple text file that can be edited through notepad or WordPad, for example.

For example, if I want to jump the page http://www.ABC.com/old.html to http://www.ABC.com/new.html, I just need to add a sentence to the .htacceess file: _ redirect 301 / old.html http://www.ABC.com/new.html.

"_ redirect 301" tells the user that the browser client and search engine are 301redirected.

"/ old.html"-provide the old page address

"http://www.ABC.com/new.html"- provides a new page address (absolute address).

In addition, if there are multiple page jumps, each jump will have to add a new record.

The above is how the virtual host does 301 redirection. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: Pages addresses hosts virtual hosts files can be passed that is engines search engines more versions users knowledge articles permanent switching search utility one word representative Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Information Docker OPPO Reno Microsoft