Adil Fazal
Adil Fazal

Reputation: 279

Directory Redirect to sub-folder with same name

I am trying to redirect directory (.htaccess) to subdirectory with same name. I am getting redirection loop error.

RedirectMatch 301 /abc  http://www.example.com/lite/abc/

Upvotes: 1

Views: 284

Answers (1)

Justin Iurman
Justin Iurman

Reputation: 19016

You must delimit your pattern otherwise it will match abc everytime.

With RedirectMatch

RedirectMatch 301 ^/abc.*$ http://www.example.com/lite/abc/

Or with mod_rewrite

RewriteEngine On
RewriteRule ^abc.*$ /lite/abc/ [R=301,L]

Note: you'll need to clear your browser's cache before trying this code. Actually, your old rule is now in cache.

Upvotes: 1

Related Questions