I'm trying to rewrite
web.com/abtoweb.com?sys=abweb.com/ab/cdtoweb.com?sys=ab&id=cdweb.comis unchanged.
I've written the following:
rewrite ^/(\w+)(/?\w*)$ /?system=$1&id=$2 break;
I'm trying to rewrite
web.com/ab to web.com?sys=ab web.com/ab/cd to web.com?sys=ab&id=cdweb.com is unchanged.I've written the following:
rewrite ^/(\w+)(/?\w*)$ /?system=$1&id=$2 break;
Testing your rewrite statement, I get:
web.com/ab to web.com?sys=ab&id= web.com/ab/cd to web.com?sys=ab&id=/cdweb.com is unchanged.You can fix (2) by moving the parentheses so that the second / is not captured. The simplest way to fix (1) is to replace your one rewrite statement with two:
rewrite ^/(\w+)/(\w*)$ /?system=$1&id=$2 break;
rewrite ^/(\w+)$ /?system=$1 break;