Forum Moderators: coopster
The articles will all still be there, just at different URL's. So, my goal is to add some code to my 404.php file to analyze the request and attempt to forward users to the page they wanted to go to, at its new location.
The problem is I can't figure out how to get the requested URL in the first place. All the normal methods like PHP_SELF and QUERY_STRING naturally refer back to 404.php itself. (I tried it on a chance it might work.) I also tried to grab the referer, but that also doesn't work (and naturally wouldn't work for the SE's anyway).
So how can I get the actual requested URL so I can process it with PHP? I've been trawling through the PHP manual but can't find anything that really looks relevant.
Thanks in advance for any ideas,
Matthew
$_SERVER['REQUEST_URI']. It sounds like you may have a full url in your errordocument (which would trigger a redirect) so make sure you have /404.php rather than http://www.example.com/404.php.
The articles will all still be there, just at different URL's
Unless I am missing something here (always a possibility) then some carefully crafted Redirect/RedirectMatch directives in .htaccess (or Windows equivalent) should eliminate any possibility of a user seeing an error page - and will also preserve ranking in the search engines.