SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
-
Feb 17, 2001, 10:02 #1
- Join Date
- Dec 2000
- Location
- Norcross, GA
- Posts
- 136
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The custom error page set up for my website is working fine, however I would like to try and take it to the next level.
Is there a way to get the URL of the page that couldn't be found by either:
a) what the user typed in the location bar
b) the bookmark address
c) link user clicked on (say from an old search engine listing)
I performed a simple test using a plain HTML page with a link to a info.php page --[ echo phpinfo(); ]
As best I could tell there is not a single environment variable that contained the URL that I clicked. There was of course HTTP_REFERER (the page it came from) and also REQUEST_URI.
The problem with REQUEST_URI is that it pulls the URI of the error.php page, not of the actual 'bad link'.
I've seen logs that list 'broken links' - I just don't know how to obtain that information.
Any and all help is much appreciated.
-
Feb 17, 2001, 11:08 #2
- Join Date
- Nov 2000
- Location
- Hong Kong
- Posts
- 1,508
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
in your .htaccess file what is the code you have for the error pages.
If you include the http://www.yourdomain.com/ part then REQUEST_URI shows the error page url instead of the actaully error requested page.
We really need the code first to solve it.
THis is my htaccess file:
Code:ErrorDocument 400 /400.php ErrorDocument 401 /401.php ErrorDocument 403 /403.php ErrorDocument 404 /404.php ErrorDocument 500 /500.php
PHP Code:<table width="569" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="223"><b>Error Code:</b></td>
<td width="326"> <? echo("$REDIRECT_STATUS"); ?></td>
</tr>
<tr>
<td width="223"><b>Requested Page:</b></td>
<td width="326"><? echo("$REQUEST_URI"); ?> </td>
</tr>
<tr>
<td width="223"><b>Refering Page:</b></td>
<td width="326"><? echo("$HTTP_REFERER"); ?></td>
</tr>
</table>
Hope this helps
Peter
-
Feb 17, 2001, 11:19 #3
- Join Date
- Dec 2000
- Location
- Norcross, GA
- Posts
- 136
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
From the .htaccess file:
ErrorDocument 404 http://www.georgiaoffroad.com/error.phtml
-
Feb 17, 2001, 11:21 #4
- Join Date
- Nov 2000
- Location
- Hong Kong
- Posts
- 1,508
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ok, if you remove the http://www.georgiaoffroad.com then REQUEST_URI will work as expect, but it means that you are going to have to place the error document in every directory.
Hope this helps
Peter
-
Feb 17, 2001, 11:26 #5
- Join Date
- Dec 2000
- Location
- Norcross, GA
- Posts
- 136
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
This will also return the following?
a) what the user typed in the location bar
b) the bookmark address
I've only been able to get REFERER to work with links - not with typing http://foo.com/foo.somepage.htm in the location bar and pressing enter... When a user types in an address, is there no way to pick that up?
-
Feb 17, 2001, 11:30 #6
- Join Date
- Nov 2000
- Location
- Hong Kong
- Posts
- 1,508
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
My code that I placed in the first post, try copying that and see if it deos want you want.
Otherwise I'm not sure what to do.
Peter
-
Feb 17, 2001, 12:32 #7
- Join Date
- Dec 2000
- Location
- Norcross, GA
- Posts
- 136
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Nevermind -- you were right, pulling http://domain.com did the trick.
Thank you for responding, btw -- I posted this same question on devshed twice in the last two months, with Zero replies.
Bookmarks