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 wish to redirect(301) a url if the url dont have a string present in it.

eg:

http:://example.com must always redirected to http:://example.com/en

http:://example.com/test.html must always redirected to http:://example.com/en/test.html

http:://example.com/test/another_page must always redirected to http:://example.com/en/test/another_page

like this.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Try this:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/en/
RewriteRule /(.*) /en/$1 [L,R=301]
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.