I've already seen Regex not equal to string and Regular expression for a string that does not start with a sequence but I can't find the right solution to my regular expression.
I need to do this: "if my HOST doesn't start with eiter s, m or www like (s.example.whatever, m.example.whatever or www.example.whatever) then redirect it to www.example.whatever.
Like this:
RewriteCond %{HTTP_HOST} ((.+)\.)+example\.(.+)$
RewriteCond %2 ^(?!s|m|www$)
RewriteRule (.*) http://www.example.com$1 [R=301,QSA,L]
It doesn't work after many tries at https://regex101.com/ What am I missing?