7700 301 Redirects in httpd.conf (not .htaccess)

pcigre

Verified User
Joined
Jun 11, 2006
Messages
8
Location
Nis, Serbia
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.
 
Code:
Redirect 301 /somefil1.html http://www.newurl/3569.html
Redirect 301 /somefil2.html http://www.newurl/13596.html...
 
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

Code:
<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.

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