Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Zachary grace
6,682 PointsRedirecting a website
I am trying to redirect people who visit my client's old website to the new one I have created for her. I had the old web developer transfer the domain name for the old site to me. I don't have access to the hosting because he hosts multiple clients site's through one account. Is there anything else I can do on my end? If not what do I need to ask the old developer to do on his end?
5 Answers
driantori
Courses Plus Student 6,422 Pointsyou can adding some javascript in the header of your document like below , this script will be redirecting all the visitor to your new website, hope this help you.
<script type="text/javascript">
<!--
window.location="http://www.yourlocation.com";
//-->
</script>
</head>
Jason Leocata
4,959 PointsFrom my experience, you'll need access to the hosting of the website to make any redirects or anything like that.
Zachary grace
6,682 PointsSo if I take the code the last person provided and ask the old designer to add it in the head of the old page should that do the trick?
Peter Ramsing
16,814 PointsYou could also have them point the A Record for both @ and www to the IP of the new site. That way they don't have to host that redirect code. ...or to be more future proof and have them work with their domain company to transfer ownership to you.
Zachary grace
6,682 PointsWell I already had him successfully transfer the domain name to me, so I have that.
Peter Ramsing
16,814 PointsIf the domain is in your hands are you able to get to the A Records to point the domain to your new site?
What company are you using to manage your domains?
Zachary grace
6,682 PointsThe hosting is through godaddy. I am not able to access the dns, but I just found a way to add forwarding. Is it better to add forwarding with masking?
Peter Ramsing
16,814 PointsThat sort of depends on the purpose. Do you want them to think they are on the old site or help them see that it is a new site (i.e. a name change or banding change). Here's Godday's quick thoughts on it: Forwarding or Masking?
Zachary grace
6,682 PointsHey Peter, thanks so much for your help. I think I got it taken care of.
Peter Ramsing
16,814 PointsGlad to hear it. Managing projects with hanging pieces from previous people involved is tough. Lots of loose pieces. Good luck!
Zachary grace
6,682 PointsFor sure. This is really the first website I have done, and it has been quite difficult with having to deal with the previous designer. He designed the whole thing in photoshop, so I had to do it from the ground up. Great learning experience though! Thanks again.
Jason Leocata
4,959 PointsThe code provided above will indeed work and redirect within the browser, if a fix is like this what your after
Zachary grace
6,682 PointsFrom what I've heard it may not be the best way to do it. Is that your point of view as well?
Jason Leocata
4,959 PointsYeah not the best way to go about it. Peter Ramsing is on the right track with you ^ up there
Zachary grace
6,682 PointsThanks for your help Jason! I appreciate it!
driantori
Courses Plus Student 6,422 Pointsin case the domain already in your hand the rest work is you only need pointing your domain name server to your hosting provider.
Zachary grace
6,682 PointsZachary grace
6,682 PointsThanks for the script, that will help, but I don't have access to the hosting to be able to put it in the head.