H
H
hckn2019-04-09 02:01:12
Nginx
hckn, 2019-04-09 02:01:12

How to redirect uppercase url and trailing slash?

What is the simplest and most efficient redirect solution for this

http://example.com/hello/
http://example.com/HELLO/
http://example.com/HELLO
http://example.com/HeLlo
и тд...

After some digging I didn't find a
http://example.com/hello
simple solution, only perl or lua scripts.
1. is there an example of such a working proven script
2. which is more efficient - pearl or lua?
3. Is there a significant drop in performance?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2019-04-09
@immaculate

Why only on perl or lua - does locationn't it work?

location ~* ^/hello/$ {
    return 302 /hello;
}

The code has not been tested, but it seems to me that it should work, there is nothing esoteric here.

V
Vladimir Mukovoz, 2019-04-09
@castomi

https://linux-notes.org/rewrite-pravila-dlya-zamen...
The first line in Google works, I personally use it on pearl, it redirects very quickly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question