简体   繁体   中英

How to redirect all users who type a particular URL of my website regardless of the cAsE they type?

Consider this example:

I have a website called www.mycoolwebsite.com, and I have got a special directory named specialdirectory under the root, and I would like to redirect all the visitors who type:

www.mycoolwebsite.com/specialdirectory

www.mycoolwebsite.com/SpecialDirectory

www.mycoolwebsite.com/SPEciALdIRectOry

www.mycoolwebsite.com/speCIalDIrecToRy

I mean, irrespective of what 'cAsE' they use, I would like to redirect all the traffic to the same location: www.mycoolwebsite.com/specialdirectory

Any help would be greatly appreciated.

Cheers. :)

You need use .htaccess file in your root site witn [NC] flag. Try some like this:

RewriteEngine On
RewriteCond %{REQUEST_URI} [NC]
RewriteRule .* http://www.mycoolwebsite.com/specialdirectory [R=301,L,NC] 

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