600+ mode rewrite rules, is this normal with apache?

We are building a website that I hope will serve 2k-5k uniques per day. Since the website is focused on Arabic speakers, we set up a .htaccess file to change the rewriting rules:

RewriteRule ^عربية$ arabic.php [L]

The problem is that we have 600 rewrite rules, such as above. Is this good with apache? or will it make my server real slow? is the tag [L] used?

+3
source share
3 answers

If you have only static keywords, I prefer to use a hash map instead of individual rules. Since the complexity of the search operation for the hash map is O (1) as opposed to O (n) for n rules.

So you can do something like this:

RewriteMap arabic-keywords dbm:/path/to/file/arabic-keywords.map

- :

عربية arabic.php
الأغاني songs.php
الفنان artist.php

httxt2dbm, -:

httxt2dbm -i arabic-keywords.txt -o arabic-keywords.map

:

RewriteCond %{arabic-keywords:$0} .+
RewriteRule .+ %0 [L]

- , , , . , RewriteMap .htaccess context.

+7

, .

arabic.php, $_SERVER ['REQUEST_URI'] php .

.

+1

- vistor, 500 . .

The tag [L]helps a bit in this performance. Especially if you keep your most used rules at the top of the page.

0
source

All Articles