Optimizing htaccess url rewriting speed

My server support tells me that my htaccess url rewrites are causing an overhead. I use URL rewriting for "nicer" urls, mostly (eg example.com/?foo=bar would be example.com/foo/bar or so). Generally speaking, what tips and tricks should you keep in mind when you want to optimize your htaccess RewriteEngine?

0


a source to share


2 answers


Move as many .htaccess directives (including mod_rewrite rules) to your httpd config (httpd.conf) - this is only once, on server restart, not on request for each directory. Other than that, unless you have too many rewrite rules or an incredibly complex custom rule, there isn't much out there.



+6


a source


Since mod_rewrite uses regex I think you better optimize your regex!



+1


a source







All Articles