?> It counts the number of folders down the path we are in the URL, then moves that number of folders up the current path... end result should be the document root :) It wont work with virtual folders or in any situation where the folder in the URL dosen't map to a real folder on the disk (like when using rewrites). lorenpr at gmail dot com 02-Nov-2005 07:04 Here's a simple function that has proven reliable for me in checking if a user has refreshed the current page on a website. function pageRefreshed() { if($_SERVER['HTTP_CACHE_CONTROL'] == 'max-age=0') return true; return false; } webmaster at eclipse dot org 11-Oct-2005 11:01 In response to tobias at net-clipping dot de It is not an Apache bug. Please read http://httpd.apache.org/docs/2.1/mod/core.html#errordocument carefully (2.1 version here, 2.0 and 1.x is similar). In short, if your ErrorDocument start with http:// Apache sends a redirect (302) to the error document, hence losing your original referer. If your ErrorDocument points to a relative path, 404 is maintained and so are your variables. From the Apache manual: "Note that when you specify an ErrorDocument that points to a remote URL (ie. anything with a method such as http in front of it), Apache will send a redirect to the client to tell it where to find the document, even if the document ends up being on the same server. This has several implications, the most important being that the client will not receive the original error status code, but instead will receive a redirect status code. This in turn can confuse web robots and other clients which try to determine if a URL is valid using the status code. In addition, if you use a remote URL in an ErrorDocument 401, the client will not know to prompt the user for a password since it will not receive the 401 status code. Therefore, if you use an ErrorDocument 401 directive then it must refer to a local document." D. drew dot griffiths at clare dot net 30-Sep-2005 11:51 Re: You can take advantage of 404 error to an usable redirection using REQUEST_URI ... Whilst this is effective, a line in the .htaccess such as: RewriteEngine On RewriteRule ^profiles/([A-Za-z0-9-]+) showprofile.php?profile=$1 [L,NC,QSA] will throw the requested profile in a variable $profile to the showprofile.php page. You can further enhance the url (e.g http://servername/profiles/Jerry/homeaddress/index.htm) and the second variable value homeaddress becomes available in $url_array[3] when used below $url_array=explode("/",$_SERVER['REQUEST_URI']); |