NameSilo

Correct way to redirect a domain

Spaceship Spaceship
Watch

John84

Established Member
Impact
2
Can someone please explain what is the correct way to redirect a domain? For example, I own www.myniche.com and have been running it successfully for a couple of years. I recently purchase my competitor's website; www.sameniche.com and would like to redirect all traffic from the new domain to my original domain.

Is the correct way a 301 redirect using .htaccess file? Or can I simply point the new domain to the same directory as the old domain through my cpanel from my host?

Thanks,

John
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
.US domains.US domains
0
•••
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Your Page Title</title>
<meta http-equiv="REFRESH" content="0;url=http://www.the-domain-you-want-to-redirect-to.com"></HEAD>
<BODY>
Optional page text here.
</BODY>
</HTML>

Put that as the index.html or .php of the new domain.
Then put your URL in the code above...
That's the easiest way to do it I think.
 
0
•••
thanks for that link weblord. so using the following code...

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>

... is just as good as creating the .htaccess file? And is that code all that I would need on that page?
 
0
•••
An .htaccess file is more likely to give a better result.

Search engines hate meta or javascript redirection.

A .htaccess file will give the correct 301 server response to spiders.
 
0
•••
Aah. Thanks for clearing that up. Question answered. Thread may be closed.
 
0
•••
sorry never told to you first, on that same page .htaccess is the best
(only to those servers that supports it btw)
some run around like the .php if it doesn't support
John84 said:
thanks for that link weblord. so using the following code...

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>

... is just as good as creating the .htaccess file? And is that code all that I would need on that page?
 
0
•••
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>

An easier way to do this is:

PHP:
header("Location: /foo.php",TRUE,301);

Read it all here: http://php.net/header
 
0
•••
I went ahead and created an .htaccess file to redirect the traffic...

Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.OriginalDomain.com/$1 [R=301,L]

...is there a way to track which traffic is coming from the new domain
 
0
•••
I would also really like a solution to this last question - how best to track incoming direct traffic to DomainA.com that has been redirected to DomainB.com.

Ideally there would be some way of picking this up in something like google analytics for DomainB.com especially if you are redirecting multiple domains to DomainB.com

Ideas anyone?
 
0
•••
0
•••
nice - that seems like a simple solution.. i'll try that now and see if google analytics picks it up
 
0
•••
0
•••
is there a way to get webmaster tools verification working with redirected domains?
I can't even get one working with a url forward at the registrar.
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer

We're social

Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back