Forum Moderators: open

Message Too Old, No Replies

Help me 301

         

Lightguy1

8:49 pm on Jun 26, 2008 (gmt 0)

10+ Year Member



Alright, any header check tool accepts my 301s, except google does not like them

They are saying that it is an empty redirect.

I see my programmer is using a html redirect, but is also sending the 301 status. Below is the code. Is this correct or should I be using something different so google will not consider these empty redirects?

IF EMPTY(pcitemno)
pcnewitemno=IIF(SEEK(UPPER(PADR((Request.QueryString("itemno")),20)), "dbpaitic", "olditemno"), ALLTRIM(dbpaitic.newitemno), "")
IF !EMPTY(pcnewitemno)
oHeader = CREATE("wwHTTPHeader",Response)
oHeader.setprotocol([HTTP/1.1 301 object permanently moved])
oHeader.CompleteHeader()
Response.WriteLn([<html><meta http-equiv="refresh"content="0;url=http://www.mysite.com/moreinfo.int?itemno=]+pcnewitemno+[ ></html>])
RETURN
ELSE

I have tried to add a different redirect besides a http and i get syntax errors each time. Any ideas?

marcel

5:48 pm on Jun 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You don't want to do a META refresh, just set the status and also Add the header.

<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://PageYouWantToRedirectTo/"
%>

Lightguy1

6:15 pm on Jun 27, 2008 (gmt 0)

10+ Year Member



In my current code, where would I add that? Do I still Response.WriteLn then add it in there instead of html?

marcel

2:33 pm on Jun 28, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not much of a classic ASP expert, but I think that this will do the trick:

IF EMPTY(pcitemno)
pcnewitemno=IIF(SEEK(UPPER(PADR((Request.QueryString("itemno")),20)), "dbpaitic", "olditemno"), ALLTRIM(dbpaitic.newitemno), "")
IF !EMPTY(pcnewitemno)
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.mysite.com/moreinfo.int?itemno=" + pcnewitemno"
RETURN
ELSE

Lightguy1

2:23 pm on Jun 30, 2008 (gmt 0)

10+ Year Member



Tried that, wasnt working. Didnt like property STATUS and also got a syntax error. Hmmm

mrMister

1:09 pm on Jul 1, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What language and web server are you using?

Lightguy1

2:12 pm on Jul 1, 2008 (gmt 0)

10+ Year Member



Asp.net and WestWind web connect v 5

marcel

8:55 am on Jul 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Asp.net and WestWind web connect v 5

Are you sure? I just checked the WestWind website, and webconnect seems to be for Visual Foxpro...

And the code example you gave is definitely not ASP.Net. I assumed it was classic ASP, but I seem to have been mistaken :)

pageoneresults

9:04 am on Jul 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That looks like the .net version of rewriting, I'm not too sure as we don't use it. Since this has been ongoing since 2008 June 26, I might suggest contacting the person who originally set that up for you and get it configured the way you want.

If the server is returning a 301 and then a 200 to the proper destination URI, why do you need to change it? When you say Google doesn't like them, exactly what do you mean. Did Googlebot send you a Dear John Letter or something? ;)

Lightguy1

2:15 pm on Jul 2, 2008 (gmt 0)

10+ Year Member



Pageone,

Google Webmaster Tools is rejecting my 301 redirects and saying they are an "empty redirect" and "not followed."

When I use a server header check tool it says I have a proper 301.

Google however, thinks differently and we all know how important it is to please the google gods.

marcel

4:03 pm on Jul 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



From the Web Connection Website:
Version 5.0 introduces a new Web Control Framework similar to ASP.NET, that lets you use the rich visual designers in Visual Studio and other tools, yet write all your processing logic with FoxPro code.

[west-wind.com...]

I would advise to try the WebConnection Support:
[west-wind.com...]

or, try contacting the programmer as PageOneResults said.

Lightguy1

5:29 pm on Jul 2, 2008 (gmt 0)

10+ Year Member



So the reason my programmer is using west wind as a webserver is because it supports processing logic with FoxPro? So does that mean I would have to have the foxpro code send the actual status? Different than from what i am now.

Isnt my programming allready sending the status below:
IF EMPTY(pcitemno)
pcnewitemno=IIF(SEEK(UPPER(PADR((Request.QueryString("itemno")),20)), "dbpaitic", "olditemno"), ALLTRIM(dbpaitic.newitemno), "")
IF !EMPTY(pcnewitemno)
oHeader = CREATE("wwHTTPHeader",Response)
oHeader.setprotocol([HTTP/1.1 301 object permanently moved])
oHeader.CompleteHeader()
Response.WriteLn([<html><meta http-equiv="refresh"content="0;url=http://www.mysite.com/moreinfo.int?itemno=]+pcnewitemno+[ ></html>])
RETURN
ELSE

**It seems to me the issue is with the meta redirect?

pageoneresults

5:34 pm on Jul 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It seems to me the issue is with the meta redirect?

That could be the issue and that is why you'll need to get the original programmer involved to make the changes you require. It appears that there are not many here who understand the logic above or they know it is best left to the inventor as there may be some other things that need to change. So, my advice is still to get the programmer on the horn and have the changes made.

Lightguy1

6:19 pm on Jul 2, 2008 (gmt 0)

10+ Year Member



The issue is my program is very good, brilliant, just does not understand alot of web stuff. I have to tell him exactly what I want, then he implements it. What exactly do I tell him we need to do? I need to be very descriptive and thourough. It looks to me like he was creating a header with a 301, but was writing out a very short html page that has the meta redirect. What I am told is it should have a location in the header and that is all it needs. The problem is, I dont know how to implement location: into this logic.

pageoneresults

6:34 pm on Jul 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



There are two "on page" methods for redirection. For classic asp...

<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "/new-page.asp"
%>

For ASP.NET...

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","/new-page.aspx");
}
</script>

What you are presenting above appears to be something that few of us here are familiar with. Again, back to the original programmer for changes. Just tell him that the page must return a 301 > 200 without any meta refreshes, etc.

You've got a whole lot of code up there to do something fairly simple. Also, we don't know exactly what that code "should" be doing. So, the examples I've posted above may not be the solution.

marcel

7:04 pm on Jul 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe this will help, try adding:

oHeader.redirect("http://www.mysite.com/moreinfo.int?itemno="+pcnewitemno)
just before oHeader.CompleteHeader()

and then remove the line:
Response.WriteLn([<html><meta http-equiv="refresh"content="0;url=http://www.mysite.com/moreinfo.int?itemno=]+pcnewitemno+[ ></html>])

Hers is some more info on what is possible with the wwHTTPHeader class:
[west-wind.com...]

Good luck

Lightguy1

7:31 pm on Jul 2, 2008 (gmt 0)

10+ Year Member



Marcel,

Thanks for the post! That seems to be what I was looking for. I added that OHeader.redirect and it seems to be functioning properly. However, if I run a test with a header check tool, its returning a 302 moved response. See below:

#1 Server Response: [mysite.biz...]
HTTP Status Code: HTTP/1.1 302 Moved
Connection: close
Date: Wed, 02 Jul 2008 19:26:31 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-type: text/html
Location: [mysite.biz...]
Redirect Target: [mysite.biz...]

Why is it saying I have a 302 response, I clearly send a 301 ?

Any ideas on why the 302 is coming through?

marcel

4:15 am on Jul 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Glad to see that it worked (almost...)

I'm well in over my head here, have absolutely no experience with Foxpro or WebConnection, if no-one else can help you here then you should try the WebConnection website for support.

Lightguy1

1:52 pm on Jul 3, 2008 (gmt 0)

10+ Year Member



Thanks for the help marcel. It seems to be the redirect you had me insert is working properly. I will keep on this and try to figure out why a 302 is being processed?

Thanks again.