configuration - Case insensitivity in nginx -


we have several seo pages like:

http://www.example.com/pageone.html 

which redirect in config like:

location = /pageone.html {   rewrite ^/(.*) /seo.php?id=1 last; } 

problem if user access page typing:

http://www.example.com/pageone.html 

"page not found" error displaying. there approximate 500+ seo pages. how write rule nginx ignore case sensitivity in url? want common solution url.

specifically pageone.html, can following:

location ~ /pageone.html {     return 301 http://www.example.com/pageone.html$1; } 

if have multiple uris need redirected, appears best option is use perl:

location ~ [a-z] {   perl 'sub { $r = shift; $r->internal_redirect(lc($r->uri)); }'; } 

if have hundreds of unique uris involve many location blocks above, i'd consider changing application handle lowercase uris rather expecting webserver handle lowercase conversion.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -