Search code examples
.htaccessurl-rewritinguppercaselowercase

Rewrite /SUBDIRECTORY to /subdirectory


I want to make it so that if a visitor navigates to:

http://www.website.com/folder

They get redirected to:

http://www.website.com/FOLDER

It is only for this specific folder that I want to affect (or intend to).

I have tried:

RewriteEngine On
RewriteBase /FOLDER/
RewriteRule ^folder(/.*)?$ /FOLDER$1 [L,R=301]

But I don't think that is right


Solution

  • In the htaccess file in your document root,

    RewriteEngine On
    RewriteRule ^folder(/.*)?$ /FOLDER$1 [L,R=301]
    

    should be good enough. You don't need the rewrite base but I don't think that'll affect it.