Racoon Posted February 27, 2010 Share Posted February 27, 2010 I want to redirect users to an error page if they enter any URL not starting with '/en/' or '/fr/'. I cannot figure out how to express this as a RewriteCond / RewriteRule. To be clearer, some examples: http://mysite.com/en/foo/ ==> Cool, do nothing http://mysite.com/fr/foo/ ==> Cool, do nothing http://mysite.com/fr/ ==> Cool, do nothing http://mysite.com/foo/ ==> ERROR, redirect to /404/index.php http://mysite.com/blah/foo/ ==> ERROR, redirect to /404/index.php I'm sure it must be pretty simple but I could not find this specific scenario addressed. If you could post the complete RewriteCond / RewriteRule, that would be awesome, as I'm quite the newbie with this. Thanks for your time. Quote Link to comment Share on other sites More sharing options...
cags Posted February 27, 2010 Share Posted February 27, 2010 Something like this should work, it's probably not the best solution, but it should work. RewriteCond %{REQUEST_URL} !^/en/ [OR] RewriteCond %{REQUEST_URL} !^/fr/ RewriteRule ^.*$ /404/index.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.