Htaccess Redirect directory to another but allow the main folder URL to stay the same

Viewed 58

We are currently using the below .htaccess code to redirect /artist/* to /artists/* which works well however, we need the URL /artist/ to remain available and not redirect through to /artists/ is this possible with .htaccess? We'd like to avoid a PHP based redirect if possible.

RewriteRule ^artist/(.*)$ /artists/$1 [R=301,NC,L]
1 Answers

If you don't want to change URL in your browser means you don't want to redirect and only want to rewrite to different URL then try following(we need to remove R flag from rules. Also this rule considers that you have /artists in your root directory if that's not the case then remove its starting slash in Rule.

RewriteRule ^artist/(.*)/?$ /artists/$1 [NC,L]
Related