James Simpson
James Simpson

Reputation: 197

Regular expression could not be compiled. Apache 2.4.18

So our host has updated their servers to the latest version of apache, and has caused all sorts of errors on the site. The main one being the following within the apache error logs, causing a 500 error on the main website.

Regular expression could not be compiled.

RewriteRule ^video-management/([A-Za-z0-9_-\s\+]+)$ manage-videos.php?bizID=$1 [NC,L]
RewriteRule ^video-management/([A-Za-z0-9_-\s\+]+)/delete/([A-Za-z0-9_-\s\+]+)$ manage-videos.php?bizID=$1&delImg=$2 [NC,L]
RewriteRule ^_shared/([A-Za-z0-9_-\s\+]+)/([A-Za-z0-9_-\s\+\.]+)/([A-Za-z0-9_-\s\+\.]+)$ _shared/$1/$2/$3 [NC,L]
RewriteRule ^plugins/([A-Za-z0-9_-\s\+]+)/([A-Za-z0-9_-\s\+\.]+)/([A-Za-z0-9_-\s\+\.]+)$ plugins/$1/$2/$3 [NC,L]
RewriteRule ^admin/([A-Za-z0-9_-\s\+]+)/([A-Za-z0-9_-\s\+\.]+)/([A-Za-z0-9_-\s\+\.]+)$ admin/$1/$2/$3 [NC,L]
RewriteRule ^pages/([A-Za-z0-9_-\s\+]+)/([A-Za-z0-9_-\s\+\.]+)/([A-Za-z0-9_-\s\+\.]+)$ pages/$1/$2/$3 [NC,L]
RewriteRule ^images/([A-Za-z0-9_-\s\+]+)/([A-Za-z0-9_-\s\+\.]+)/([A-Za-z0-9_-\s\+\.]+)$ images/$1/$2/$3 [NC,L]

I cannot understand how anything should have changed with an update to Apache, and looking over the regular expressions on the above, seems that I cannot see any errors which would cause this issue.

When I comment out the above lines, the website works again (well mostly).

Upvotes: 0

Views: 3665

Answers (2)

James Simpson
James Simpson

Reputation: 197

After a couple of days bashing my head, I finally figured out that there was an error in the regular expression.

The correct result should be

 ([A-Za-z0-9_\-\s\+]+)

I missed a \ before the dash.

Upvotes: 1

Gislef
Gislef

Reputation: 1637

I did not quite understand your question. But you can make a comparison of active modules in the earlier version of apache with the current version of Apache, maybe some module is disabled and is not recognizing the .htaccess.

Check your httpd.conf file.

Another possibility is the path in .htaccess try replacing:

RewriteBase /

to

RewriteBase /folderYourHosting/example.com/

Upvotes: 0

Related Questions