Jump to content

How do I express this with a RewriteRule and/or RewriteCond?


Racoon

Recommended Posts

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.