I am attempting to control redirections on my site using the Apache vhosts config.

I have two-letter regions setup, such as /fr, /de, /es, which I am currently ignoring as you will see from my vhosts file below. However I also have a 301 permanent redirect setup to redirect /cm (and /fr/cm, /es/cm etc) to another page - this is controlled in my back-end system.

The complication is when I add the line RewriteCond %{REQUEST_URI} !^/cm this is caught by the RewriteCond, however I then cannot access /fr, /de, /es etc at all as they seem to get stuck in a loop and go to: www.ayrshireminis.com/fr/fr/fr/fr/fr/fr/fr/fr and then it HTTP 500 Internal Server Errors.

How could I change the RewriteCond to allow for:

/pa (this will be redirected to /minis, but it is controlled in the database and needs to stay as a valid URL)
/fr (the region)


    # ----------------------------------------------------------------------
    # Below will remove region specific part of URL and load content from main UK site
    # ----------------------------------------------------------------------
    RewriteCond             %{REQUEST_URI}                  ^/([a-z]{2})$                   [OR]
    RewriteCond             %{REQUEST_URI}                  ^/([a-z]{2}/)(.*)$
    RewriteCond             %{REQUEST_URI}                  !^/cm
    RewriteRule             ^([a-z]{2}/|[a-z]{2})(.*)$      /$2                                             [L,QSA]

    # For VirtualDocumentRoot development instance configurations
    RewriteRule ^([^.]+)$ /index.php?url=$1 [L,QSA]