• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Should I promote 404s? (nifty programming idea)

Magic2K2

New Member
Before you jump the gun, and say, what the heck is this guy thinking, let me explain.

I have an NBA player database, in which player files are accessed in the following way:

http://........./nba/profile.php?player_id=123

with 123 equaling whatever player_id it is they are looking for.

The problem is that many search engines will not accept a URL such as this and this is a very important part of my site for searching. I could get some traffic from people searching for any of the 400+ players in my database if I can get them indexed.

So, what I am considering is the following:

Submitting non-existent files such as http://......./nba/profiles/michael_jordan.php

to the engines and then have a 404 file in the /nba/profiles/ directory that figures out the $REQUEST_URI and queries the database to find out what player_id that player refers to. Note that /nba/profiles/michael_jordan.php DOES NOT exist.

Also, note that this is not a redirection thingy. The user will actually be looking at the 404 file which, through some programming, included the contents of the appropriate player's file.

I don't know if I explained this well so feel free to ask questions.

Thanks in advance.
 
Hmm...seems like a lot of trouble. Maybe have a large index of the players, so any player searched will appear, and links to the player id from there?

Don't know if search engines will accept fake names of pages. Some will, but more advanced spiders may not. I don't know much about search engines though.
 
If it would work I would go for it but some search engins may think your trying to cheat them and black list you

they may think your cheeting because some people made cgi scripts find out if it was a person viewing the page and then it would send them to a "real" page, or if it was a spider veiwing the page. in that case it would goto a doorway page. I think it was a great idea while it lasted, but it didn't last long

anyways Im not sure if a search engine would think your doing this but if it did then it could be trouble :(
 
The thing is that this is not a redirection, nor a doorway. They will actually be at /nba/profiles/michael_jordan.php or whatever. It's just that the words "michael" and "jordan" are kinda like hidden parameters used in the actual file /nba/profiles/404.php

The URL bar will say /nba/profiles/michael_jordan.php

I don't want to get blacklisted, though, so if anybody has any more knowledge on the subject, please post.
 
Search engines will not list 404 pages. Your server is going to send an HTTP 404 response code, no matter what the page itself looks like.

I understand what you're thinking, and it's creative, but it won't work.

One way you can accomplish your goal is to use mod_rewrite (assuming Apache here). You can have a URL that looks like (as a real-life example):

http://support.basiclinuxhost.com/Articles/000008.html

Nice static HTML page, right? Wrong. mod_rewrite turns that into:

http://support.basiclinuxhost.com/article.php?ID=8

This example is extremely simple, but you can get much more complex than this. The rewrite rule for this is simply:

RewriteRule ^Articles/([0-9]{6})\.html\??(.*)$ /article.php?ID=$1 [l]

There are of course other ways to do this, but I can assure you search engines don't like to index error documents :)
 
There is a much easier way (when using Apache and PHP) than what they show... assume a URL like this:

blah.com/script.php/value1/value2/value3

Rather than doing what they show, simply do this:

$vars = explode("/",$PATH_INFO);

$PATH_INFO contains the path after the script name, if you use a URL like the above. The site linked above instead tries to parse this itself using the REQUEST_URI, even though Apache has already done this.
 
Back
Top