PDA

View Full Version : 7700 301 Redirects in httpd.conf (not .htaccess)



pcigre
10-28-2007, 03:59 AM
I currently have situation like this on my Apache 2 + DA powered vps:

One site has 7700 lines in .htaccess filled with 301 redirects with 850KB in total. As .htaccess is loaded on every request that make some load on my VPS. I would like to move those redirects into httpd.conf so its load only on apache restarts.

What and how should I do? Please have in mind I'm total noob in server administration.

Should I edit /usr/local/directadmin/data/users/someuser/httpd.conf

or

/etc/httpd/conf/httpd.conf

And how? Copy lines from .htaccess? Do I need to modify lines and where to copy?

Thanks in advance to all that'll try to help.

chatwizrd
10-28-2007, 07:36 AM
What do some of the lines look like?

pcigre
10-28-2007, 07:42 AM
Redirect 301 /somefil1.html http://www.newurl/3569.html
Redirect 301 /somefil2.html http://www.newurl/13596.html...

chatwizrd
10-28-2007, 08:00 AM
You should be ok to put them in the virtual host block of the domain in the users httpd.conf file then.

What I would do since there will be so many lines is setup an Include instead of adding all the lines directly to httpd.conf

Add something like this in the users httpd.conf



<VirtualHost>
....

Include /usr/local/directadmin/data/users/username/httpd-redirects.conf
</VirtualHost>


Put a few in that file to test with first off before you end up moving all of them over.

Make sure to do the following to that new file too.



chmod 750 /usr/local/directadmin/data/users/username/httpd-redirects.conf
chown diradmin:username /usr/local/directadmin/data/users/username/httpd-redirects.conf

pcigre
10-28-2007, 08:17 AM
I'll try asa I get home. Thanks.

pcigre
10-28-2007, 05:27 PM
It works fine for now. Ill monitor load to see if there is any improvement.

pcigre
10-31-2007, 04:33 PM
It helped a bit. Not a huge improvement, but ther is less lag while opening page.