Somebody, I really need a response to this. I have posted here in the forum before and gotten no response. Please talk to me! [email protected] I need someone to step me through how to set up a 301 redirect that will eliminate the website at http://rainbowriting.com and send all traffic from there permanently to http://www.rainbowriting.com - Google is telling me I have duplicate content, just because the site shows up in both places. So I want to permanently end the site's presense at the www-free address and send all traffic from it to the www address. Please don't tell me to set up or use an .htaccess file - I've tried this and can't get it to work using MS Expression Web, which is what I use to publish the site. I need to somehow do this in my II6 panel on the computer, which already does have an HTML redirect function, but it doesn't work either. I need to input both the www and the www-free sites somehow into the panel, and then redirect traffic from one to the other. And I don't know how to do this - please help me. Thank you in advance for a prompt and timely response, this time. Karen
Hi, Sorry if you never got any response. Speaking for myself I must have missed it before. I looked at your site and it appears you are only using HTML pages. Correct? The easiest way, I believe, to handle this will be with a default classic ASP page in the root of your site. It can be used to sniff the address request and take the site visitor to your www as needed. Sound good? If you don't know how to do this I can help. I used to do this on a DASP IIS6 server with three domains, depending on the request from the incoming visitor I would serve up the correct site. It's fairly seamless to them. As for tricking Google, I've given up on that. ;-) All the best, Mark
You can tell Google - through webmaster tools (Site configuration > Settings > Preferred domain) - to only index your site from the www or non-www version of your URL. That should also eliminate the duplicate content issue. http://www.google.com/support/webmasters/bin/answer.py?answer=44231&hl=en
wisemx, I have a similar issue and am on IIS6. Most of the pages on my site are ASP, however. Could you help me set a default page in the root of our site to redirect traffic from http://metrix.com to http://www.metrix.com? I have set the preferred domain in Google Webmaster Tools, but that doesn't seem to completely take care of it. Thanks!
Here you go... In the code below the lines at the top are debug lines for testing. The code also shows how to make two additional checks. You can change this many ways to get to what you want. Code: <% 'Response.Write(Request.ServerVariables("URL") & "<br />") 'Response.Write(Request.ServerVariables("ALL_HTTP") & "<br />") 'Response.Write(Request.ServerVariables("LOCAL_ADDR") & "<br />") 'Response.Write(Request.ServerVariables("REMOTE_ADDR") & "<br />") 'Response.Write(Request.ServerVariables("REMOTE_HOST" & "<br />")) 'Response.Write(Request.ServerVariables("SERVER_NAME") & "<br />") Dim Caught Caught = Request.ServerVariables("SERVER_NAME") If Caught = "thissite.com" Then Response.Redirect("http://www.thissite.com") ElseIf Caught = "thissite.com/" Then Response.Redirect("http://www.thissite.com/") Else Response.Redirect("http://www.thissite.com") End If %>
Thanks for the code. I appreciate it. My default page is index.asp, so I took this code snippet and placed it at the top of the page. When I do that, however, I get a message "The webpage at http://www.metrix.com/ has resulted in too many redirects." Any ideas on what I'm doing wrong? I apologize, I'm not good with the coding. Code: <% 'Response.Write(Request.ServerVariables("URL") & "<br />") 'Response.Write(Request.ServerVariables("ALL_HTTP") & "<br />") 'Response.Write(Request.ServerVariables("LOCAL_ADDR") & "<br />") 'Response.Write(Request.ServerVariables("REMOTE_ADDR") & "<br />") 'Response.Write(Request.ServerVariables("REMOTE_HOST" & "<br />")) 'Response.Write(Request.ServerVariables("SERVER_NAME") & "<br />") Dim Caught Caught = Request.ServerVariables("SERVER_NAME") If Caught = "metrix.com" Then Response.Redirect("http://www.metrix.com") ElseIf Caught = "metrix.com/" Then Response.Redirect("http://www.metrix.com/") Else Response.Redirect("http://www.metrix.com") End If %>
...Trim it down and skip the "/" filtering. That part isn't really needed. Just remove the lines for ElseIf, that way you check to see if the www is there and then the final line is just for insurance.
Even if I remove that and just leave the Else line in there for insurance, I get the same error. It works if I strip it down to this code: Code: <% Dim Caught Caught = Request.ServerVariables("SERVER_NAME") If Caught = "metrix.com" Then Response.Redirect("http://www.metrix.com") End If %> However, is the re-direct fully in place without the Else line?
Oh, I just took out the debug lines so you could see it better. Thanks for taking the time to help me with all this!
The code posted on this thread result in a 302 redirect. Is there a way to perform a 301 redirect with ASP code?