I want to redirect one subdomain to another subdomain in the same domain. Godaddy hosting replied to me saying: The hosting account you are currently running is a Windows shared hosting account. With the Windows based hosting, you will want to use the ASP code for the redirect, as PHP runs off of the Linux hosting accounts. Can anyone tell me what code to use and how it should look if I want to redirect: http://www.exa*mple.com/apples/index.html to http://www.exa*mple.com/oranges.html It looks like the code that Godaddy recommended is: ASP .NET - save this as oldpagename.aspx private void Page_Load(object sender, System.EventArgs e) { Response.Status = "301 Moved Permanently"; Response.AddHeader("Location","http://www.new-url.com"); } Please use my examples in the code as I'm daft enough to need that at this point. And finally, which directory on my hosting do I upload this file to once I'm done? The root for "exa*mple"? Thanks.
I just opened a notepad file and inserted: private void Page_Load(object sender, System.EventArgs e) { Response.Status = "301 Moved Permanently"; Response.AddHeader("Location","http://www.exa*mple.com/oranges.html"); } ...Saved it as "apples.aspx" and uploaded it to the root of the "exa*mple" folder, but the redirect is not happening as the apples site is still loading up. What's going wrong here?
So are you saying that when you go to http://www.exa*mple.com/apples/index.html you want the redirect to occur? If so you need to add something like <script runat="server"> private void Page_Load(object sender, System.EventArgs e) { Response.Status = "301 Moved Permanently"; Response.AddHeader("Location","http://www.exa*mple.com/oranges.html"); } </script> Code (markup): to your http://www.exa*mple.com/apples/index.html page. That should work.
I added that code to the bottom of my apples page and reuploaded it, it didn't work. I have other files named .index in different folders on my site. I tried doing that and putting it in both the root folder of the main domain as well as the subdomain for the old site and it didn't work, anyway. What about a meta redirect? Is that what it's called? I use that for affiliate links and all of that, so I suppose I could just delete all content from the apples page and put a meta redirect, would I keep the links and all that this way? Help I've tried everything here!
This is the code i use <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Your Title</title> <meta http-equiv="REFRESH" content="3;url=http://Yoursite.WTV"></HEAD> <BODY> Your Msg </BODY> </HTML> the #3 after content is how many seconds it waits to send you to the new link
Thanks, I think I'm straight on doing a meta redirect, but I thought rankings don't transfer as easily that way so it's best to do a 301 which I still need help with if anybody reads this thread. Thanks.
If you have access to your .htaccess file, just include 301 redirect /old-url-path new-full-url-including-http