Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

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.