1

I have webserver with nginx.

In HTML pages, I have lots of urls like: köln.jpg, münchen.jpg, köln-münchen.jpg. I can not edit the pages.

However on the disk some files are stored as "koln.jpg" or munchen or koln-munchen.jpg. I can not rename the files.

I basically need if image file is not found, file to be look as follows:

ö -> o
ü -> u
ä -> a

also same for caps - Ä -> A etc.

At the moment I am thinking to implement simple PHP script that doing this, if there is 404 error, using nginx 404 document.

However I am thinking there might be easier way using nginx rewrite.

This question is somehow related, but is not the same:
How to replace underscore to dash with Nginx

Community
  • 1
  • 1
Nick
  • 9,962
  • 4
  • 42
  • 80

1 Answers1

0

You could try to handle such requests with rewrite_by_lua statement. here is detailed documentation with clear example.

EvilElk
  • 1
  • 1