Anvar Freelance Web Designer and SEO Expert Logo
01 / 01
WhatsApp Logo +91 808 999 0405

How to redirect website to another url via .htaccess

Redirect individual website address to another one
To redirect individual files, like to about-me.html you can use a 301 redirect like this:

Redirect 301 /about.html /about-me.html

To redirect one specific file to another domain such as to

Redirect 301 /oldurl.htm

Redirect an old domain to a new domain
If you had an old domain name such as, and now you decided you actually want to use new domain for the website. You could setup a 301 redirect for the entire domain, so that old links to carry over.
Code in the domain’s .htaccess file:

RewriteEngine on
 RewriteCond %{HTTP_HOST} ^ [NC,OR]
 RewriteCond %{HTTP_HOST} ^ [NC]
 RewriteRule ^(.*)$$1 [L,R=301,NC]

Force to use www. in domain
A search engine like Google,yahoo,bing would see and as essentially two separate websites. They recommend you pick one version
Code in the domain’s .htaccess file:

RewriteEngine on
 RewriteCond %{HTTP_HOST} ^ [NC]
 RewriteRule ^(.*)$$1 [L,R=301,NC]
by anvar
Published : Mar , 5
  1. Wonderful goods from you, man. I have understand your stuff previous
    to and you are just too fantastic. I really like what you’ve acquired here,
    certainly like what you’re saying and the way in which you
    say it. You make it enjoyable and you still take care of
    to keep it sensible. I cant wait to read much more from you.
    This is really a tremendous site.

  2. I know this site provides quality dependent articles and other material, is there
    any other web page which provides these information in quality?

  3. Good article! We are linking to this particularly great post on our website.
    Keep up the great writing.

  4. What’s up, just wanted to mention, I loved this post.
    It was helpful. Keep on posting!

Post a comment

Your email address will not be published. Required fields are marked *