Redirect entire website and pages - 301 redirect htaccess

admin

Administrator
Staff member
To move an entire website to another domain without hurting your search rankings simply use the following code on your htaccess file:

Code:
RewriteEngine on
RewriteRule ^(.*)$ http://website.com/$1 [R=301,L]

Remember to replace http://website.com with your new domain.
 
This looks handy. I may be giving this a try later this year and since it will be the first time I've tried to move a site that has a database, I'll be looking for lots of tips.
 

Sander k

New member
DJB said:
To move an entire website to another domain without hurting your search rankings simply use the following code on your htaccess file:

Code:
RewriteEngine on
RewriteRule ^(.*)$ http://website.com/$1 [R=301,L]

Remember to replace http://website.com with your new domain.

With or without the $1?
 

jaran

New member
Sander k said:
DJB said:
To move an entire website to another domain without hurting your search rankings simply use the following code on your htaccess file:

Code:
RewriteEngine on
RewriteRule ^(.*)$ http://website.com/$1 [R=301,L]

Remember to replace http://website.com with your new domain.

With or without the $1?

$1 is mean all your URL domain will move permanently to destination domain.
 

ogah

New member
Sander k said:
DJB said:
To move an entire website to another domain without hurting your search rankings simply use the following code on your htaccess file:

Code:
RewriteEngine on
RewriteRule ^(.*)$ http://website.com/$1 [R=301,L]

Remember to replace http://website.com with your new domain.

With or without the $1?

without $1 all URL will redirected to new domain homepage only.
eg. http://olddomain.com/everything.html will redirected to http://website.com/

with $1 will redirected to full path
eg. http://olddomain.com/everything.html will redirected to http://website.com/everything.html
 

waffy

New member
Hey guys is this correct and recommended, it's www redirection only
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^/?$ "http\:\/\/www\.domain\.com\/" [R=301,L]
 

inupinu

New member
I am using built in redirect feature of redirection on cpanel of my website. There are multiple options available for the redirect.