-1

Possible Duplicate:
best way to handle thousands of permanent redirects

As object.

I need to do 301 redirect, for about 40.000 pages. I know that putting this quantity of lines in .htaccess maybe will slow the site, but in httpd.conf peraphs will be more faster, right ?

any advice ?

p.s. yea, it's not possible do some regex..i need about 40.000 lines of 301 :-/

CalfCrusher
  • 105
  • 8
  • oh yea, sorry. It's a dedicated server (not vps) with Centos.. we have only this site on this server. The site generate about 50.000 visits at month. – CalfCrusher Sep 26 '12 at 23:32
  • i found this topic: http://serverfault.com/questions/414225/best-way-to-handle-thousands-of-permanent-redirects seems to be very useful, i'll try !! – CalfCrusher Sep 26 '12 at 23:50

1 Answers1

2

Sounds like Apache is your web server. Since you mentioned you can't use regex, here are couple of other suggestions:

1) .htaccess

You should avoid using .htaccess files completely if you have access to httpd main server config file. Using .htaccess files slows down your Apache http server. Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same effect with better performance.

http://httpd.apache.org/docs/2.4/howto/htaccess.html

2) RewriteMaps

If URLs you are redirecting from/to are too unique, to be matched by patterns, use RewriteMaps, especially DBM Hash File.

When a MapType of dbm is used, the MapSource is a filesystem path to a DBM database file containing key/value pairs to be used in the mapping. This works exactly the same way as the txt map, but is much faster, because a DBM is indexed, whereas a text file is not. This allows more rapid access to the desired key.

http://httpd.apache.org/docs/current/rewrite/rewritemap.html

Alain Kelder
  • 106
  • 4
  • Alain Kelder: thanks !!!! i'll use probably the RewriteMaps good advice, thanks !!! i'll come back here with (hope!) good news! – CalfCrusher Sep 27 '12 at 07:39