Click to See Complete Forum and Search --> : Error 404?


SuzanneB
06-15-2008, 07:31 AM
I have a web site with a few hundred pages. To help with the organisation of the pages, they need to be renamed. Now web pages called

blah_blahdeblah.php

Will be renamed to

blah1_blahdeblah.php
blah2_blahdeblah.php
blah3_blahdeblah.php

For the moment, so that the search engines can still find pages, there there needs to be redirection from all the old names to the new names.
This is easy to do, but a bit time consuming.
I was thinking instead that replacing the 404 html with PHP I can get the requested URL and try removing the first four chars and replacing it with blah1, blah2, or blah3. If any exist, then all it needs to do is set the name of the new file in a redirect page. Does this sound reasonable?

NogDog
06-16-2008, 01:05 AM
I'm not sure that the search engines would like that, as they'd still be getting the 404 HTTP header, so may not even read the page contents and just treat it as a dead link.

SuzanneB
06-16-2008, 02:11 AM
They would not be getting the header, because I can configure that on my server. I have complete control over the page that is served on a 404. If I can find the file it is looking for, then I can serve that instead.

NogDog
06-16-2008, 02:35 AM
I thought the web server would send the 404 header and then output the designated error page, but a little testing on my part indicates otherwise. However, for the search engines to "like" that, you would probably need to have your custom page output a 301 "permanent redirect" to make the search engines happy, which should be no big deal if you end up using PHP as you could do it via the header() command. However, I'm not clear on what the logic is to know what name to change each page to. If you can work that out, then all you'd need is a Location header, too:

header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.yoursite.com/blahX_blahblah.html');
exit;