RewriteCond: cannot compile regular expression (after upgrade apache to 2.4.54)

Zhenyapan

Verified User
Joined
Feb 23, 2018
Messages
1,204
Location
UA
Hello,

Centos 7, Apache (mod_php) was upgraded from 2.4.49 to 2.4.54 after that error log start filling with error reports:
--
[Thu Jun 16 23:25:09.039564 2022] [core:alert] [pid 15282] [client 74.125.151.103:0] /home/agro/domains/agro.tld/private_html/.htaccess: RewriteCond: cannot compile regular expression '/\\index\\.php.*'
[Thu Jun 16 23:25:10.164514 2022] [core:alert] [pid 17878] [client 74.125.151.107:0] /home/agro/domains/agro.tld/private_html/.htaccess: RewriteCond: cannot compile regular expression '/\\index\\.php.*'

--

with htaccess like this:
--
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Options -Indexes

RewriteCond %{REQUEST_URI} /ims.*
RewriteCond %{REQUEST_URI} !/_files.*
RewriteCond %{REQUEST_URI} !/favicon\.ico.*
RewriteCond %{REQUEST_URI} !/\index\.php.*
RewriteCond %{REQUEST_URI} !/\ims\.php.*
RewriteRule ^.* /ims.php [L]

RewriteCond %{REQUEST_URI} !/ims.*
RewriteCond %{REQUEST_URI} !/_files.*
RewriteCond %{REQUEST_URI} !/favicon\.ico.*
RewriteCond %{REQUEST_URI} !/\index\.php.*
RewriteCond %{REQUEST_URI} !/\ims\.php.*
RewriteCond %{REQUEST_URI} !/robots\.txt.*
RewriteCond %{REQUEST_URI} !/sitemap\.xml.*
RewriteCond %{REQUEST_URI} !/receiver\.html.*
RewriteCond %{REQUEST_URI} !/sitemap_1\.xml.*
RewriteCond %{REQUEST_URI} !/sitemap_2\.xml.*
RewriteCond %{REQUEST_URI} !/sitemap_imex\.xml.*
RewriteCond %{REQUEST_URI} !/uploads.*
RewriteRule ^.* /index.php [L]
--

Nothing changed in webserver configs afer updgare. So I must create custom_versions.txt and recompile/downgrade Apache to 2.4.51 - all works fine now!
--
Can anybody say what's wrong in new Apache version so it don't want to work with asterisks "*"?
Thanks!
 
Last edited:

wattie

Verified User
Joined
May 31, 2008
Messages
1,229
Location
Bulgaria
Not an expert in regex, but this:

Code:
RewriteCond %{REQUEST_URI} !/\index\.php.*

looks wrong to me as \ is used to escape character and it is followed by i (from index) which I believe is not to be escaped.
 

Zhenyapan

Verified User
Joined
Feb 23, 2018
Messages
1,204
Location
UA
looks wrong to me as \ is used to escape character and it is followed by i (from index) which I believe is not to be escaped.
so something changed in apache syntax? I checked apache changelog and didn't find anything about this. But i's only one user/domain affected from more than 1200 domains on updated servers, rest will wait till apache 2.4.55 maybe it will solve this.
 
Top