Forum Moderators: coopster
I'm hoping this will be an easy one.. I'm trying to use a custom 404 to redirect pages from my old url to a new url. The code i'm using is like this:
$redir = $_SERVER["REQUEST_URI"];
header("Location: [domain.com$redir");...]
However this is not working, for some reason the $redir is going through as "404.php", rather than the trailing part of the address. Any suggestions on what I'm doing wrong?
Many thanks,
Don
redirect 301 / http:// www.newsite.com/
http:// www.foo.com/section/2/ -to-> http:// www.bar.com/section/2/
Don
No, it will send any request that starts with "/" to the new server, and append anything that follows the slash to the new URL.
See Redirect and RedirectMatch in Apache mod_alias [httpd.apache.org].
The only problem with this method is that if your use a canonical url instead of a local url-path, the 404 status code will be lost, and be replaced with a 302-Found status, as described in the documentation.
Jim