Benjamin Dean
Benjamin Dean

Reputation: 769

Rewrite to non-existing subfolder

Let's say, I have a simple URL like /page/subpage/ and I want it (and it's subpages) to be fully accessible via /en/page/subpage/. What rewrite rules should I apply here? Already tried:

RewriteCond %{REQUEST_URI} !/en/page/subpage/$
RewriteRule ^(.*)$ /page/subpage/$1 [L,QSA]

But it redirects every URL, because of ^(.*)$ part.

Upvotes: 0

Views: 36

Answers (2)

anubhava
anubhava

Reputation: 785491

You can use this simple rule:

RewriteRule ^en/(page/subpage/.*)$ $1 [L,NC]

Upvotes: 2

arco444
arco444

Reputation: 22841

You should be able to do it as below:

RewriteRule ^en/page/subpage/(.*)$ /page/subpage/$1 [L,QSA]

Upvotes: 1

Related Questions