0

There is a website site.ru/ I need to write a regular expression where pages longer than 3 characters only work after the first slash. If in this case there are other pages after the slash, then 404 was returned. For example

site.ru/demo -> site.ru/demo
site.ru/dem/dem -> site.ru/dem/dem
site.ru/demo/{string of any length} -> 404

I wrote the following regular expression,

map $example {
            default 0;
            "~[^\/]\w.{3,}" 1;
}

but it works on both site.ru/demo and site.ru/demo/demo. Where is my mistake?

All In
  • 1
  • 1

0 Answers0