I tried to write a rule for multilingual site. For example, www.hostname.com/fr & www.hostname.com/de are ok, but trying any other language tag should redirect to www.hostname.com/en. www.hostname.com/it redirects to www.hostname.com/en, www.hostname.com/es redirects to www.hostname.com/en etc...
I succeed to make some rules in a "positive" way, but each time I add a ! to create a negative rule, it doesn't work.
For example :
RewriteCond %{HTTP_HOST} ^www.hostname.com$
RewriteCond %{REQUEST_URI} ^/?([a-z]{2})/?$
RewriteCond %{REQUEST_URI} ^/?(fr|de)/?$
RewriteRule (.*) http://www.hostname.com/en [L,R=301]
This code redirects everything to hostname.com/en. I want that only tag different than fr et de redirect to en. So I tried :
RewriteCond %{HTTP_HOST} ^www.hostname.com$
RewriteCond %{REQUEST_URI} ^/?([a-z]{2})/?$
RewriteCond %{REQUEST_URI} !^/?(fr|de)/?$
RewriteRule (.*) http://www.hostname.com/en [L,R=301]
Just added a !. But it doesn't work, URL are never redirected. I've probably missed something in writing rules...