If you want to change a webname for your wordpress, you may need to redirect the original site to a new one permanently. This tutorial will talk about 301 redirect, which can lead the user to the new site without few lost. Here assumed you want to redirect site A(www.a.com) to site B(www.zzsay.com), and you are using a apache hosting, if your host is IIS, please refer to another article in my blog.

For apache hosting, it is very easy to redirect one site to another permanently using 301 redirect. Just add some codes in your .htaccess file which should be found in your root directory.

Steps of 301 redirect for a whole site

1. Download your .htaccess in site A with a FTP software.

2. Open the .htaccess with notepad.exe or wordpad.exe

3. Add these codes in .htaccess:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.a.com$ [NC]
RewriteRule ^(.*)$ http://www.zzsay.com/$1 [L,R=301]

4. Save .htaccess and upload it to the original directory, the old htaccess will be replaced.

5. Ok, type the site A url in the address bar, you will get http://www.zzsay.com automatically. 

 

Samples 301 redirect for wordpress

Native .htaccess in the root:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Change to(Note: Please change the URL path to your own. ):

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.a.com$ [NC]
RewriteRule ^(.*)$ http://www.zzsay.com/$1 [L,R=301]
</IfModule>

# END WordPress