0

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.

3

Try this:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/en/
RewriteRule /(.*) /en/$1 [L,R=301]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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