My rewrite rule is currently:
rewrite ^/answer/1/(www\.)*(.)(.+)$ /answer/1/$2.html last;
So requests such as:
mydomain.co.uk/answer/1/aa
mydomain.co.uk/answer/1/www.aa
mydomain.co.uk/answer/1/www.aa/
mydomain.co.uk/answer/1/www.aa/something
mydomain.co.uk/answer/1/www.aa/something/even-deeper/and-so-on
Provides the document:
mydomain.co.uk/answer/1/a.html
Now I want to split the response so that requests such as:
mydomain.co.uk/answer/1/aa
mydomain.co.uk/answer/1/www.aa
mydomain.co.uk/answer/1/www.aa/
will provide the previous document:
mydomain.co.uk/answer/1/a.html
But requests that go any further such as:
mydomain.co.uk/answer/1/www.aa/something
mydomain.co.uk/answer/1/www.aa/something/even-deeper/and-so-on
will provide the new document:
mydomain.co.uk/answer/1/new.html
How should I change the above regex condition to accommodate the requirement?