Cuarcuiu
Cuarcuiu

Reputation: 527

Url rewrite that ignore some folders

I have a centos server and i'd like to rewrite the url in this way:


Example

From:

/lang/"folder1"/"folder2"/"filename_n.php"

to:

/lang/filename_n.php

From:

/lang/"folder1"/"folder2"/"folder3"/"filename_n.php"

to:

/lang/filename_n.php

The folder "lang" is static while the other folders and file name change.

Very thank's :-D

Upvotes: 1

Views: 29

Answers (1)

anubhava
anubhava

Reputation: 785266

You can use this rule in root .htaccess:

RewriteEngine On

RewriteRule ^lang/(?:[^/]+/)+([^/]+)$ lang/$1 [L]

Upvotes: 1

Related Questions