301 code for changing the domain name of the website without losing traffic

301 code for changing the domain name of the website without losing traffic

Generally speaking, it is not recommended to change the domain name unless there is no other way. For example, for well-known reasons, I have to change my .cn domain name to a .com domain name, and I can only do a 301 redirect.
Either the domain name is blocked, such as free8.com is blocked and needs to be changed.
Here is the jump code:

# BEGIN WordPress
Options +FollowSymLinks
RewriteEngine on
rewritecond %{http_host} ^www.old.com [nc]
rewriterule ^(.*)$ http://www.new.com/$1 [L,R=301]
# END WordPress

Among them, www.old.com is replaced with your old domain name, and www.new.com is replaced with your new domain name. This is suitable for linux PHP code, used in .htaccess file.

<<:  Introduction to SharkSpace, an American hosting provider

>>:  Introduction to NetOrigin, Australia's best hosting provider

Recommend

Wishosting 2GB RAM KVM VPS Los Angeles Simple Review

Details: Wishosting: $3.99/month/2GB memory/12GB ...

virtualcards: You can apply for Mastercard credit card, support Alipay recharge

virtualcards provides a paid application for a Ma...

2014 Excellent WordPress Responsive Themes (Part 1)

1. WordPress Theme V1 Theme Introduction: Free Th...

DeployNode: $11/year/512MB memory/10GB space/250GB traffic/OpenVZ/Phoenix

DeployNode, an Indian hosting provider, was estab...

AlienVPS offers $4 512MB OpenVZ VPS

According to the information on LowEndBox, AlienV...