fixxel
fixxel

Reputation: 187

mod rewrite path in url

I would like to rewrite with the .htaccess-file in root directory the internal path example.com/app/app-v1/ (including all subdirectories) to example.com/app/in the url, so that everything in the /app-v1/ folder is right behind the /app/ directory in the url.

I tried

RewriteEngine On
Redirect /app/app-v1/ /app/ 

but that's not working

Upvotes: 2

Views: 115

Answers (1)

anubhava
anubhava

Reputation: 785146

You may try this code in site root .htaccess:

RewriteEngine On

RewriteRule ^app/((?!app-v1/).*)$ app/app-v1/$1 [NC,L]

(?!app-v1/) is a negative lookahead to avoid rewriting URI starting with /app/app-v1/ to this rule.

Upvotes: 2

Related Questions