Forum Moderators: phranque

Message Too Old, No Replies

short uri handling 200 ok or 301 moved header?

what would be the best header when handling short uri

         

Maxie

10:48 pm on Jul 9, 2003 (gmt 0)

10+ Year Member



Hi
I'm building a site that uses query strings to serve the right content.
I've decided to provide short uri's for bookmarks and reference purposes.
These short uri's are translated to the query string and I use a header to have the browser requesting the actual page.
I've noticed that this works both with a 200 OK header and a 301 permanently moved header.
Since the short uri *is* valid I tend to use 200 OK, but I worry about it beeing within the HTML specs?
It works with exporer, but about anything works with explorer..
Should I use 301 instead to be correct HTML wise?

Aside, 200 OK would create duplicate content pages which might be bad..

Any comments about the correct handling of short uri's?

Err, just found out that there is such a thing as 303 see other, which might be what i'm looking for.

ref: [w3.org...]

DaveAtIFG

6:03 pm on Jul 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld Maxie! :)

The pages you want the SEs to index should ALWAYS return a 200 header. If you are revising your site and you presently have existing pages with long URLs indexed in the SEs, those pages should return a 301, after the short URL versions are available. The 301 should redirect the SEs to the new, short URL pages. Doing this will alert the SEs that the pages have been "moved" and that they will soon be removed from the site. In response, the SEs will update your listings. This updating process can take several months. Since using a 301 on the long URL pages effectively tells the SEs "don't index this page, go to the new page and index it," duplicate content is not an issue.

Maxie

9:29 pm on Jul 10, 2003 (gmt 0)

10+ Year Member



Hm, not quite what I mean.
I uderstand about normal redirecting using 301.
But in this case, the script uses long uri's, so that is the normal condition.
www.foo.bar/index.php?cat=monkeys&page=what-they-eat
I want to provide short uri's as an extra for people to use in links and emails and such.
www.foo.bar/what-they-eat

So I wrote an extra script that translates the short uri back into the long one (by searching for the file in all categories) and then send a header to have the browser fetch the right page. And this header should have some status code.

Now I thought 200 should be ok because the short uri is valid, but it seems odd to say 200 ok and yet have the browser fetch another page.

301 would seem not really apropriate as well cause nothing has moved..

Meanwhile I found the 303 code which seems ok.
Btw I do assume that both browsers and spiders handle all
30x codes the same way.

To make a long story short, how does one redirect if the url is valid but the content is somewhere else..

thanks for your time

Max

DaveAtIFG

1:57 am on Jul 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Properly coded browsers and spiders both handle 30X codes the same.

If your script is simply returning a header, use a 30X code so visitors rerequest the correct page. If your script is returning a header AND delivering a page, use a 200.