1

If I have a website of about 200 pages and most of the links will be inevitably changing, what is the faster way to redirect them (fastest not in terms of how quickly I can do it, but in terms of the minimal load on the server)?

I have also made a differentiation between creating "RewriteRule"(s) that might redirect 20 links, versus using only the "Redirect" path commands.

Here are the different options that I see:

  1. Within a Wordpress plugin
  2. .htaccess RewriteRule when possible
  3. .htaccess Redirect always
  4. vhost .conf RewriteRule when possible
  5. vhost .conf Redirect always

I assume it is option 4, but I haven't found a very definitive answer online.

  • How does the "200 pages" vs "20 links" relate? Are you changing just "20 links" or links to all "200 pages"? – MrWhite Dec 17 '14 at 23:01
  • Sorry not so clear, I would probably have about 10 rewrite rules rewriting 20 links each (to a total of about 200 pages). – lawdawg Dec 18 '14 at 4:25
1

For 20 links, you are not going to notice a speed difference with any of those methods. None of them are going to add significant overhead.

There is significant overhead added by PHP and WordPress to run your site. The redirects are not going to impact performance at all.


For a very large quantity of redirects (thousands), individual rewrite rules are the worst option. Rewrite rules each have to be tested one at a time for each request. There is no way for the webserver to use a more efficient mechanism such as a lookup in a hash map.

Here is a question an ServerFault that addresses how to implement a very large number of redirects: Best way to handle thousands of permanent redirects It suggests using the RewriteMap functionality to do the lookup.

In the case of 20 redirects, scanning over them is going to be just as efficient as a hash lookup. Until you get to at least hundreds of redirects, it isn't something you need to worry about.

  • I know this is getting hypothetical, but would option 4 be the best if it were a very large quantity? – lawdawg Dec 18 '14 at 4:26
  • I added info to the answer about many redirects. – Stephen Ostermiller Dec 18 '14 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.