Nginx rewrite to lower case

Posted February 26, 2019 10.6k views
NginxPHPWordPressDebian 9

Good Day, I have a nginx server and a WordPress site. At the moment my pages are available by url with a different case (for example, about-us and AbOuT-Us opens the same page). How to redirect all pages to lower case, but keep the ability to open files with different case (for example, in Woocommerce there are files like Woocommerce.js)?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Hey friend,

You can supposedly use perl to accomplish this in the Nginx config. Have you tried Wordpress plugins that claim to do this first? I don’t know if they do it by writing rules to .htaccess (Apache only, of course), but it might be worth a try:

Otherwise it looks like this describes the process of forcing it at the Nginx layer:


  • Hello, thanks for the links.

    I tried the second method, but when accessing files that have a large letter in the name (Woocommerce.js for ex.), the server returns 404 error

Heya, found this plugin that supposedly will do what you`re asking: