Please suggest me how can i able to redirect 301 url in .httaccess file

I have a old domain name which i like to transfer to another domain name. Please suggest me how can i able to redirect 301 url in .httaccess file.

With something like:

Redirect 301 / http://www.newdomain.com

I found this tutorial handy. It has a section on Redirection, which explains:

The first path to the old file must be a local UNIX path. The second path to the new file can be a local UNIX path, but can also be a full URL to link to a page on a different server.
In this case, you’re redirecting the root directory / to a new domain.

TechnoBear answer is perfectly accurate.

You can also issue a permanent redirect from your cPanel if you don’t want to alter your .htaccess file by yourself. It is fairly easy though.

If you want to redirect everything to the new domain, not just the root, use


Options +FollowSymlinks -MultiViews

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

TechnoBear’s redirect directive will do that too. :wink:

EDIT: Though, I think TechnoBear’s tutorial got it wrong when it talked about Unix file paths. The argument to redirect is actually a URL path.