/    Sign up×
Community /Pin to ProfileBookmark

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?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJun 16.2008 — 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.
Copy linkTweet thisAlerts:
@SuzanneBauthorJun 16.2008 — 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.
Copy linkTweet thisAlerts:
@NogDogJun 16.2008 — 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:
[code=php]
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.yoursite.com/blahX_blahblah.html');
exit;
[/code]
×

Success!

Help @SuzanneB spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...