• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 461
  • Last Modified:

Site Redirect

Hi all,

I need to point www.domain.com to www.anotherdomain.com so if someone goes to a bookmarked page at the first site (any directory) they end up at the home page of the second site.
I can't have the host do it until the morning - is there an .htaccess or similar I can ftp into the root to accomplish something similar in the meantime?

Thanks,
Sean
0
seanpowell
Asked:
seanpowell
  • 4
  • 2
  • 2
  • +2
1 Solution
 
yuzhCommented:
You can change the DNS record to make

 www.domain.com as the CNAME of  www.anotherdomain.com, if you want the ULRs
show up properly and use the contains of www.anotherdomain.com, you need to defind
 www.domain.com  as a VirtualHost of  www.anotherdomain.com and use the same
DocumentRoot .


Or
use .htaccess file:
    http:Q_20599405.html


anther way to redire dirs only, have a look at the answer in
    http:Q_21270618.html

0
 
humeniukCommented:
Hi Sean,

Looks like yuzh's first link went awry.  Here's my recommendation for an .htaccess redirection:

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

FYI - the 'R=301' is important due to the search engine implications of redirecting.  A permanent (or 301) redirect is the only one that will reliably pass PageRank from the source site to the destination site.

Hope this helps.
0
 
humeniukCommented:
Thanks for the correction & the tip, ahoffman :)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
avgavgCommented:
- I find that the simplest way to do this provided both www.domain.com and www.anotherdomain.com are online is to create a new index.htm file with the following code...
<html>
<head>
<meta http-equiv="REFRESH" content="0; URL=http:www.anotherdomain.com">
</head>
</html>
and to place a copy of the file in the root and in all directories of www.domain.com.

All visits to www.domain.com will be automatically re-directed to www.anotherdomain.com 

Good luck!
0
 
seanpowellAuthor Commented:
Thanks everyone :-)

It seems like I will have to handle this through the host as there's no way to get
http://www.domain1.com/anydirectory/anyfolder/anypage.html to redirect to:
http://www.domain2.com

So I'll use that approach for now...

Thanks,
Sean
0
 
ahoffmannCommented:
> ..  I find that the simplest way
hmm, I'd say that's the most complicated way (replacing tons of existing index.html, don't forget the index.shtml, index.php, etc. etc.)

> It seems like I will have to handle this through the host as there's no way to get
what does this mean? what is not working and how did you verify this?
0
 
seanpowellAuthor Commented:
>>I'd say that's the most complicated way
I concur :-)

>>what is not working and how did you verify this?

I put this into the .htaccess file, changing the domain names:

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

Then I went here:

http://www.domain1.com/anydirectory/anyfolder/anypage.html

and got a page not found at

http://www.domain2.com/anydirectory/anyfolder/anypage.html

since the entire folder structure is different.

This:
http://www.domain1.com/anydirectory/anyfolder/anypage.html
or this:
http://www.domain1.com/anotherdirectory/anyotherfolder/anyotherpage.html

needs to simply redirect here:

http://www.domain2.com/

So I'll just have to wait until I can access the host directly and have them make the changes to the domain instead... does that make sense?

0
 
ahoffmannCommented:
> since the entire folder structure is different.
means that any request to domain1, whatever URL it is, has to be redirected to root in domain2?

RewriteEngine On
RewriteRule ^.*$ http://www.domain2.com/ [R=301,L]
0
 
seanpowellAuthor Commented:
That's the ticket - thank you so much :-)

Sean
0
 
seanpowellAuthor Commented:
Hmmm...

that looks very similar to the code in the link that yuzh gave:

RewriteEngine on
RewriteRule   ^.*$   http://www.domain2.com [R]

Have I accepted the wrong comment here?

Sean
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now