/    Sign up×
Community /Pin to ProfileBookmark

Mass redirects?

I’m doing a website for a writer. She has 400-500 articles that will be databased, however, she has links to these articles from her old site and those links must remain intact. So, I have 400-500 redirects I need to set up, like:

[url]http://www.ilanamercer.com/HonestAbesAnguish.htm[/url]

needs to go to

[url]http://www.ilanamercer.com/phprunner/public_article_list_view.php?editid1=31[/url]

I know how to redirect a single url but is there a way I can set up a single file to handle this for me? If so, would someone point me in the right direction?

Thanks,
Susan

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@tfk11Jun 28.2008 — You could use mod_rewrite to handle the redirect. Add a rewrite rule to your .htaccess file that redirects any requests for htm files to your script. The script will then have to to determine what story to show based on the name of the htm file requested.

RewriteRule ^(.*).htm$ /index.php?htm=$1

You'll probably want to use another database table to store the associations between the htm filenames and story ids. So in your script do something like...

[code=php]
if( isset($_GET[htm]) )
query( SELECT story_id WHERE htm_filename = $_GET[htm] );
if( match found )
show the story
[/code]
×

Success!

Help @SWilson 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.17,
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,
)...