httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Malo>
Subject Re: [users@httpd] mod_rewrite problem
Date Tue, 16 Dec 2003 13:29:02 GMT
* Edwards Jim <> wrote:

> I am currently testing the use of the following rewrite rules to rewrite
> http://localhost/somepage/childpage to
> http://localhost/pages/childpage.php?parentPage1=childpage. The problem is
> that the CPU usage oc my server goes up to 100% when processing the URIs.
> My question is how can I optimize these rules to lower the CPU usage? 
> RewriteEngine On
> RewriteRule ^([A-Za-z0-9_]+)*$ /pages/$1.php [L]
> RewriteRule ^([A-Za-z0-9_]+)/([A-Za-z0-9_]+)*$
> /pages/$2.php?parentPage1=$1 [L]

Which version of Apache do you use? Are rules written in server context or
in a htaccess file? (Behaviour is different). I see two general
problems anyway (without testing):

| RewriteRule ^([A-Za-z0-9_]+)*$ /pages/$1.php [L]

The regex used is not deterministic since you have nested optional parts
with no fixed point inside. What do you want to express *exactly* with it?
(The same applies to the second rule)

2nd: If you're exceuting the rules from within a htaccess file, it's likely
that you run into an infinite loop. Recent versions of Apache will break
that loop, therefore: which version are you using?


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message