Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 :-/

share|improve this question

marked as duplicate by Michael Hampton, John Gardeniers, rnxrx, Ward, mulaz Oct 1 '12 at 14:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
What web server? –  Mark Johnson Sep 26 '12 at 23:29
    
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. –  ienabellamy Sep 26 '12 at 23:32
    
i found this topic: serverfault.com/questions/414225/… seems to be very useful, i'll try !! –  ienabellamy Sep 26 '12 at 23:50

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
    
Alain Kelder: thanks !!!! i'll use probably the RewriteMaps good advice, thanks !!! i'll come back here with (hope!) good news! –  ienabellamy Sep 27 '12 at 7:39

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