PDA

View Full Version : 404 Error page



techno_race
06-27-2008, 10:54 PM
I am currently working on my 404 error page, and regular expressions are giving me a headache. :mad: (/^(\http\.*whatever.)
I need a script that does the following. Regular expression segments are bolded. Please make all instances of mysite into a variable.

If window.location is equal to
http://www.mysite.com
OR
http://www.mysite.com/
document.write the following:
<strong>http://www.mysite.com/</strong>

If window.location is equal to
http://www.mysite.com/.+ that does not end with / or \.\.+
AND
window.location is not equal to
http://www.mysite.com/errors
document.write the following:
<strong>window.location + "/"</strong>

If window.location is equal to
http://www.mysite.com/.+/ that ends with /
AND window.location is not equal to
http://www.mysite.com/.+\.\.+\/\/
document.write the following:
<strong>window.location</strong>

If window.location is equal to
http://www.mysite.com/.+\.\.+
document.write the following:
<strong>window.location</strong>

If window.location is equal to
http://www.mysite.com/errors/.*
OR
window.location is equal to
http://www.mysite.com/errors
redirect the user to
window.location with a capital 'E' in 'errors'.

If window.location is equal to
http://www.mysite.com/.+\.\.+\/\$/
redirect the user to
window.location without the trailing '/'.

If none of the above are true
document.write the following:
<strong>window.location</strong>