Maintain URL if there is no page
Posted 08 May 2006 - 11:47 AM
If someone visits my website using a non existant page url or may just have typed incorrectly in the browser location.
For example they may have typed:
[a href=\"http://www.mydomain.com/a/nonexistant\" target=\"_blank\"]http://www.mydomain.com/a/nonexistant[/a]
I would like the browser to maintain what they have typed in the address box but I would like to display a page which can handle a php script to display a message based on what they entered for the url.
I would have no problem writing the script to display the message but I am struggling on working out how to maintain the url which is important to me. I can work out how to use htaccess for a 404 redirect but that's not what I want
I assume it would be using some 404 handler but can't work it out myself. Any help greatly appreciated.
Posted 08 May 2006 - 02:03 PM
Info: PHP Manual
Posted 08 May 2006 - 04:13 PM
i have something similar to this in my .htaccess (note: NOT full url):
ErrorDocument 404 /index.php?page=404_error
ErrorDocument 403 /index.php?page=403_error
and in index i use switch to load the 403/404 pages i made. When i hit for example www.mydomain.no/jhgfaqgfa - the htaccess loads the index switch while the url still is the same as when mistyped - no change.
by using $_SERVER['REQUEST_URI'] in your 403/404 document, you can split and use whatever is in the adress bar.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users