Can anyone please point me to a tutorial or article or give a solution (with some explanation) on how to redirect one level up if certain string exists at the end of the URL.
For example
http://www.example.com/s/texas/hello-world/
should be redirected to
http://www.example.com/s/texas/
Assume the string is ‘hello-world’ and I have 100 different urls
i.e
/s/florida/hello-world
/c/boston/massachusetts/hello-world etc.
Thanks in advance.
The expression below captures everything before
hello-worldinside(.*)as$1and redirects to it. The/?makes the trailing slash optional.