Skip to main content

Redirect 301 with htaccess

When you have an new domain for your blog/website, you should redirect your old domain to the new. This keeps your visitors in touch with your blog/website. Some changes in .htaccess file are useful.


Browse the file manager of your site. Open .htaccess file then put these code into it:



Options +FollowSymLinks

RewriteEngine on

RewriteCond %{HTTP_HOST} ^YOUR_OLD_DOMAIN_NAME [NC]

RewriteRule ^(.*)$ http://YOUR_NEW_DOMAIN_NAME/$1 [R=301,L]

Example: your old domain is domain1.com and your new domain domain2.com. Then you need have .htaccess file like:
Options +FollowSymLinks

RewriteEngine on

RewriteCond %{HTTP_HOST} ^DOMAIN1.COM [NC]

RewriteRule ^(.*)$ http://DOMAIN2.COM/$1 [R=301,L]

That's all.

Wish succeed!

Comments

Popular posts from this blog

Create Wordpress page template

When creating a new page in Wordpress, we usually have a choice for the page template. It's call Default template . However, we sometimes need to make a new page with a new appearance. Then another page template is needed. Instead of downloading a shared page template from internet, we can create a new page template by below instructions.

Insert Google Search box into blog/website

Normally, every  blog/website has a search function which supports everyone to easily browse the site contents. But it maybe not really useful and effective. Then Google Custom Search is a brilliant choice for you. How to get it?