Reputation: 23
I am getting this error in Apache error log and my website is unable to open in Apache 2.4.9
RewriteRule: cannot compile regular expression '^/?([a-zA-Z0-9_+-\\s+]+)$'
but I am able to open the website in earlier version of apache, please help what is wrong with apache 2.4.9?
RewriteRule ^/?([a-zA-Z0-9_+-\s+]+)$ ?x=$1 [QSA,L]
Upvotes: 2
Views: 4519
Reputation: 786091
Change your rule to this:
RewriteRule ^/?([\w+\s-]+)$ ?x=$1 [QSA,L]
Hyphen needs to be at the start or end in a character class to avoid escaping.
Upvotes: 5