/    Sign up×
Community /Pin to ProfileBookmark

redirect 301 via htaccess or php?

Hi I am redeveloping a big website. The page names of the old site are really bad and so I will be renaming them. There are loads of links pointing to the website so I am planning to do a ‘permanent moved’ 301 redirect.

I was wondering if this is better done via the htaccess file or to do it via php?

I am thinking about doing it via php as there are hundreds of pages and I really don’t want to have to enter all those pages into the htaccess file.

thanks for the advice.

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@MindzaiFeb 27.2009 — I would personally do it via .htaccess. If the list is really huge you can always use PHP to generate the .htaccess file. If you do it purely in PHP and you get any future issues with PHP on the server, suddenly your redirects all break. If you use apache itself, it will only break if someone misconfigures apache, in which case your site is likely to suffer anyway. I imagine it would also be faster to allow apache to handle this than PHP.
Copy linkTweet thisAlerts:
@stephan_gerlachauthorFeb 27.2009 — that's actually a good idea. I will use php to generate the htaccess file. I just really didn't want to have to copy and paste all these redirects into a file.
×

Success!

Help @stephan_gerlach 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.16,
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,
)...