Large .htaccess files causing grief (and performance loss)

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 6
Joined: 26 Mar 2012, 07:09

Large .htaccess files causing grief (and performance loss)

26 Mar 2012, 07:19

Here's the present situation:

We have series of sites, that are using the same IIS folder and thusly the same .htaccess file.

Our customers have total freedom regarding the rewrite URLs they can use, we don't enforce IDs in the URLs or things like that.

Because of these two condition, our .htaccess file becomes very large very quickly (currently about 13K lines and climbing) - since we need lots of RewriteCond lines (looking at the domains) to determine which RewriteRule must be hit.

We've considered possibly using the VirtualHost command in the httpd.conf file, to build sort of a "switch case" - as we figure this would dramatically cut down on the needed RewriteCond lines (since we would then only need one VirtualHost block per site, in which we could put all our RewriteRules).

I am looking for input from anyone who might have any ideas (both expanding on what I've described as well as new ones) on how to go about handling these kind of loads in terms of rewrites.

Best Regards
Michael Christensen

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Large .htaccess files causing grief (and performance los

27 Mar 2012, 05:54

Hello,

well, according to documentation <Location> directive may be used only in server config or inside <Virtuals host>.
<Virtuals host> could be used only in httpd.conf.

So in anyway the first thing to do is to relocate all the rules and move them to httpd.conf.

Regards
Andrew

User avatar
Posts: 6
Joined: 26 Mar 2012, 07:09

Re: Large .htaccess files causing grief (and performance los

27 Mar 2012, 06:05

As far as I understand it, there is only one httpd.conf per IIS server (correct?).

Since we run many sites on the same IIS, we would need to put all our rules for the different sites into the same httpd.conf file.

My concerns with that are:

1) It will become very large very quickly
2) When ever a customer changes any of his/her rewrites, we would have to recreate the httpd.conf file with fresh content for all customers on that server that use rewrites (correct?) - and I fear that we would run into locking/race conditions problems.

Any advice on how to deal with that?

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Large .htaccess files causing grief (and performance los

27 Mar 2012, 07:43

Well, these concerns lead us to an idea that you need to copy this folder several times and use several different .htaccess files.
This will allow your customers to have more flexible system of rewrite rules and will separate rules into smaller files.

Regards
Andrew

User avatar
Posts: 1
Joined: 12 Dec 2014, 07:10

Re: Large .htaccess files causing grief (and performance los

12 Dec 2014, 07:12

Recently had some security problems and changed the permissions on my directories which resulted in the images no longer being displayed.

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 10 guests