Mobile app version of vmapp.org
Login or Join
Kaufman445

: Is a .htaccess rewrite rule a potential performance issue? I use a .htaccess rewrite to redirect: RewriteEngine on RewriteBase / RewriteCond %{REQUEST_URI} !^/redirect-to-this-subfolder/ RewriteCond %{HTTP_HOST}

@Kaufman445

Posted in: #Htaccess #Performance #Redirects

I use a .htaccess rewrite to redirect:

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_URI} !^/redirect-to-this-subfolder/
RewriteCond %{HTTP_HOST} ^(www.)?domain-to-redirect-to-subfolder-of-ditto.
RewriteRule ^(.*)$ /redirect-to-this-subfolder/ [L]


Could that become a performance issue for a heavy trafficed site?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Kaufman445

1 Comments

Sorted by latest first Latest Oldest Best

 

@Nimeshi995

Simple answer. No. Absolutely not.

There was a period where people on the net claimed that is was, however, at the time this was going on, Apache had already made changes quite a long time before that make the whole argument moot. It was major-league silliness then, and yet, it still echoes today.

The .htaccess file is cached within the Apache process and a trigger set so that if the file is modified, it gets loaded. There is no re-reading of the file over and over as many claim. If this were true, then the Apache programmers would have to climb a high ladder into the clouds and look up to see poor.

You can load the booger-snots (official technical term) out of your .htaccess file and there will be very little cost in doing so. The caveat is that processing any .htaccess file is recursive. This means that as a rule is applied, the whole set of rules are reapplied. In this, any sets of rules not written properly can cause more than the single recursion. Still, this is so tiny in the world of 2.4Ghz 16 core CPUs that any complaints in any regard is beyond laughable.

In short, get a beer and do not worry about it.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme