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

General Discussion

Redirecting 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

you 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>

Thanks for the script, that will help, but I don't have access to the hosting to be able to put it in the head.

From my experience, you'll need access to the hosting of the website to make any redirects or anything like that.

So 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?

You 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.

Well I already had him successfully transfer the domain name to me, so I have that.

If 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?

The 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?

That 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?

Hey Peter, thanks so much for your help. I think I got it taken care of.

Glad to hear it. Managing projects with hanging pieces from previous people involved is tough. Lots of loose pieces. Good luck!

For 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.

The code provided above will indeed work and redirect within the browser, if a fix is like this what your after

From what I've heard it may not be the best way to do it. Is that your point of view as well?

Yeah not the best way to go about it. Peter Ramsing is on the right track with you ^ up there

Thanks for your help Jason! I appreciate it!

in case the domain already in your hand the rest work is you only need pointing your domain name server to your hosting provider.