简体   繁体   中英

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/

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM