dynamic content redirection using 404 pagesI fixed a rather nasty bug in sillytech today, which had been stopping Google from indexing any of the user or thread pages. This happened because of how the user and thread pages work. You see they don't actually exist. There is no file on my webserver called '~dustin' and there is no file with the path '/threads/10' either. All of these pages are served to you through a bit of shifty work involving 404 error pages.
In a few '.htaccess' files (which are responsible for setting apache web server configuration) I have ErrorDocument 404 handlers setup. Then on the handler page the requested URL is examined (using PHP's $REDIRECT_URL variable). The page determines what it is that the user actually wants and outputs it to their browser.
The problem was that since it was being served through an error handler document apache would also send a HTTP status code of 404 (meaning page not found). SInce google doesn't appear to index things that return this code (sensibly enough) none of these pages were being searched by google. I believe that the problem has been corrected, by setting the status header directly from the error handler (in PHP it's done with 'header("Status: 200");').
Anyway, the reason that any of this is done is that I like having clean URLs.
1 comment |
|
|
Vorg — Tag Cloud
Written by dustin Latest PhotoQuote of Now:FriendsPopular PostsComputer Games
|