KBD

Keith Devens .com

Saturday, July 5, 2008 Flag waving
All I want is to have my peace of mind. – Boston (Peace of Mind)
← Entry 1259Entry 1261 →

Daily link icon Wednesday, January 16, 2002

Entry 1260

Check it out... question for anyone who's really familiar with how HTTP and Apache work. If I want to move a page on my site, say, from somefile.php3 to somefile.php, I can rename the file, but I want to leave some indication that the file moved, for a while at least, so that search engines can update their records (except Inktomi which continues searching to this day for pages I haven't had on my site for years).

I can do one of two things. I can leave a dummy page in the old place (since the page is PHP I can write code there...) which I can have send a 301 return code to indicate that the page has been "moved permanently", and give the page's new location. Alternately, I can just let the person get a 404, and then have my 404 page (it's PHP again Smiley try to find the current version of the page. For instance, if someone looks for somefile.htm, somefile.html, somefile.php3, somefile.phtml, etc. I can have it look to see if there's a somefile.php and automatically redirect them to that from the 404 page.

My questions are: is it wrong to send a Location: header from a 404, and does that really "mean the same thing" as a 301? Will spiders treat it similarly? Finally, is there any way to suppress the 404 code if I can figure out through code that the page actually exists, sending a 301 code and a Location: header instead? What would I have to do with Apache to make this happen?

I just realized I forgot to explain a little of my reasoning. I'd much rather have the logic put in my 404 page because there I can have it all in one place rather than having dummy files cluttering up my web space for every page I've ever had on my site that might exist with another name. The thing is, I don't want to be returning 404 codes if the page does exist but has just moved, because that's what 301 is for.

← Entry 1259Entry 1261 →

Comments XML gif


Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

July 2008
SunMonTueWedThuFriSat
 12345
6789101112
13141516171819
20212223242526
2728293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 5 posts

Recent comments XML

Girls, please don't get breast implants

> And no, you will not be receiving​a picture.

:-(...

Keith: Jul 2, 6:05am

Javascript clone function

This is a clever way to clone an​object if you are using YAHOO UI.​Same tec...

Antonio: Jul 1, 12:47pm

I hate Norton Antivirus

Oh just one other thing norton is​great at keeping people out of your​compu...

kevin.sands: Jul 1, 12:50am

Terminator 3 was awful

I think the biggest reason why T3​totally blew was because Edward​Furlong g...

76.167.172.64: Jun 29, 3:06am

Generated in about 0.147s.

(Used 8 db queries)

mobile phone