简体   繁体   中英

htaccess RewriteRule to redirect from a directory that doesn't exist

I am attempting to redirect any URLs that attempt to access a directory that doesn't exist, however I am getting a 404 when trying the following:

RewriteRule ^picco/(.*)$ /rangers/$1 [L,R=301]

There is no directory called picco however, when anyone tries to access a page picco/index.php for example I want to redirect to rangers/index.php .

Is this possible?

I've got it - the following works, it seems the introduction of RewriteBase had a substantial effect.

RewriteBase /
RewriteRule ^picco(.*)$ /rangers/$1 [R=301,L]

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