Hi there! This has been really annoying me for a few hours- I can't seem to crack it.
Assuming I'm using a url scheme like [
whatever.com...] and I'm supporting en, de and fr language codes, and I come accross a url with it at the root of the url path, how can I redirect to a default, like en?
For example, If I visit www.whatever.com/es/ad/hoc/path, as es is not supported, I want to redirect to www.whatever.com/en/ad/hoc/path. The rule I've been using (and failing with) is this:
RewriteCond %{REQUEST_URI} !^/[en|de|fr](.*)$
RewriteRule ^$ /en/$1 [R,L]
What I think that means, is that if a url does not begin with en, de or fr, capture the remainder of the url (expressed by the wildcard before the dollar in the RewriteCond), then prepend it with en in the rewrite rule.
It (or variants of it) work.... if I want endless redirects. Can anyone shed any light on how to accomplish this?
Many thanks