How can I pass the 404'd URL to my 404.html page using .htaccess
For example, if I visit an invalid page: /user/123
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
ErrorDocument 404 /?404.php?error_path={???}
^
=========================================^
Resulting in a 404 redirect to /404.php?error_path=/user/123
You can't append the path of the site which threw the error to the URL of the displayed error page using the ErrorDocument directive. However as you're working with PHP you could use the global
$_SERVER["REDIRECT_URL"]
value from within your error handling script.See http://httpd.apache.org/docs/current/custom-error.html#variables for more information: