Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having some problems with rewrites... can please someone help me out here?

Currently I have this:

Redirect example.com/*/ to example.com/en/* if da,de, and en were not found.

RewriteCond %{REQUEST_URI} !^.*/(da|de|en|en-uk)/.*$
RewriteRule ^(.*)$ /en/$1 [L,R]

This wasn't the problem - the problem is with the following: 1. example.com/xx/* -> example.com/en/* - for any two letters which are not in (da,de,en|en-uk)

How to craft this?

share|improve this question

Try this:

  RewriteCond %{REQUEST_URI} !^/(da|de|en|en-uk)/
  RewriteRule ^/../(.*)$ /en/$1 [L,R]

There are a few problems that I can see with your original code:

There is a period and a dollar sign in the RewriteCond, at the end. That would only match /xx/X. Remove the dollar sign to match any length on the end. Remove the "." before dollar sign to allow for empty matches after the slash.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.