2

I've asked a question over at Stackoverflow thinking that it wasn't really EE related

https://stackoverflow.com/questions/18229829/set-up-of-conditional-redirect-in-htaccess

But now I'm not so sure that the rules I'm using to remove index.php aren't having an effect.

Any help appreciated.

1
  • Can you post your final answer here for people to see without having to link? Aug 15, 2013 at 10:45

1 Answer 1

2

This is what I eventually went with;

# Rewrite for new language based urls
# This is to try and get all current pages going to /en/(old url) with a 301 redirect
RewriteCond $1 !\.(gif|jpe?g|png|ico|js)$ [NC]
RewriteCond %{REQUEST_URI} !^/(index\.php|en)(/.*)?$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /en/$1 [R=301,L]

# Removes index.php
RewriteCond $1 !\.(gif|jpe?g|png|ico)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

I'm sure that could be refined a fair bit as there is some duplication but it works so I'm happy with it for now as it is a temporary requirement.

1
  • Did you ever refine this at all?
    – Stephen
    Jun 13, 2014 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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