简体   繁体   中英

Using .htaccess to redirect to a subfolder

I'm trying to 301 redirect from '/en' or '/en/' to '/en/home' using .htaccess, but any attempt I do results into a redirection loop '/en/home/home/home/home/home/home...'.
Shouldn't it be as simple as Redirect 301 /en /en/home ?

Redirect based rule keep matching /en in redirected URL as well. You can use RedirectMatch for this with regex support:

RedirectMatch 301 ^/(en)/?$ /$1/home

Also make sure to clear your browser cache when you test this.

You have to use the full URL, example:

redirect 301 /folder_wrong/name.html http://website.com/folder-right/name.html

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