473,385 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Cookie Redirect Script

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
1 1767
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Alexandre | last post by:
What's the best I can do to solve my trouble : I got a simple page index-tmp who include a code snippet who test if a cookie exist and if yes redirect to the user account page but the trouble is...
2
by: bagsmode | last post by:
Hi, I'm trying to set a session cookie and then redirect, however I get the error: Status: 302 Moved Location: /index.cgi I thought I recall getting an error like this when I first tried...
3
by: Karsten Grombach | last post by:
Hi, I'm trying the following: - Imitate a Logon using a Post with HttpWebRequest on remote Webserver (asp 3.0 page using https) - On success redirect to the page (encapsuled in an iframe)...
0
by: Bill Borg | last post by:
Hello all, Not sure I can describe this adequately, but I am creating an endless loop when an authenticated user signs out. When the user signs out, I want to remove authentication, abandon...
4
by: Joe | last post by:
Hi, I have a asp.net page that checks if any one of the two cookies exists. If none of the cookies exist then redirect the user to login page. Cookie “try” doesn’t exists. I can see that...
6
by: Alessandro Fachin | last post by:
Hi, i am trying to forge a new cookie by own with cookielib. But i don't still have success. This a simply code: import cookielib, urllib, urllib2 login = 'Ia am a cookie!' cookiejar =...
4
by: BritishAgent | last post by:
I'm just starting to learn PHP. I have a website where we are collecting votes for something. I want to use cookies to deter people from re-voting (yes, this is not efficient if they're smart...
2
by: fran7 | last post by:
Hi, I have this very nice link tracker script that works a treat. The only thing is it doesnt restrict repeat clicking. Is there a simple method to add a cookie feature to this so that people...
8
by: LayneMitch via WebmasterKB.com | last post by:
I'm supposed to develop a page that asks info as form values and when you hit "submit" it takes you to a page that reads the values you entered into the first page and displays those values in a...
2
by: phpmagesh | last post by:
Hi to all, I am creating a registration page, like name, last name, Date of birth, ph number, address etc.. When i click submit button all the values are taking to validation page using POST...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.