By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,934 Members | 1,476 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,934 IT Pros & Developers. It's quick & easy.

Cookie Redirect Script

P: n/a
Hello

I've been looking for a small snippet of code which I haven't had much luck
finding. I was wondering if anyone is aware of a script that might be able
to do the following for me:

On my website, I get quite a bit of 404 traffic. What I was looking for is
the first time a surfer goes to the 404 page, it will redirect the user to
http://www.page1.htm. At the same time, it would place a cookie on his pc.

Should the user come back and get a 404 page within X hours (A number I'd
configure), the second time, he would be redirected to http://www.page2.htm.
If he came back a third time, he would go to http://www.page3.htm.

If X=24 hours, and 24 hours passes and the user comes back and gets a 404
page, the whole process would start again and this time he would go back to
http://www.page1.htm.

Thank you
Aug 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Carved in mystic runes upon the very living rock, the last words of
<no@spam.com> of comp.lang.javascript make plain:
On my website, I get quite a bit of 404 traffic. What I was looking
for is the first time a surfer goes to the 404 page, it will redirect
the user to http://www.page1.htm. At the same time, it would place a
cookie on his pc.

Should the user come back and get a 404 page within X hours (A number
I'd configure), the second time, he would be redirected to
http://www.page2.htm. If he came back a third time, he would go to
http://www.page3.htm.


Something like:

(1x) Sorry, that page isn't here.
(2x) Sorry, that page *still* isn't here, and won't be any time soon.
(3x) WHAT, ARE YOU %##$^&$# STUPID!? THE PAGE ISN'T HERE!!!!

:)

Make your 404 page a page which just checks the cookie, sets or updates
it as needed, and then sets window.location accordingly.

Although you're probably better off doing this with server-side
scripting, or with mod_rewrite if you're using Apache.

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
Aug 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.