django - Change publicly visible URL and but keep URL same internally -
in django project, have app views urls beginning /a. during development, have been accessing app a's using full url, i.e., localhost:8000/a/foo. launch, want map urls app top level domain. if app has url /a/foo , domain www.a.com, user should see www.a.com/foo. set following nginx block internally redirect user right url app a:
location / { include /usr/local/etc/nginx/uwsgi_params; rewrite / /a$request_uri break; uwsgi_pass unix:/tmp/mysite.sock; } so if user enters www.a.com/baz, going url /a/baz internally.
throughout html code, there get/post requests require page reload, example:
<a href='/a/foo/'>click here</a> when such request made, not want url in browser window show www.a.com/a/foo, rather www.a.com/foo. this, added following rule:
location /a { rewrite ^/a/(.*)$ /$1 last; } the idea url beginning /a hit rule , rewritten, , other location block trigger. rule not hit urls beginning /a , instead other rule hits, resulting in url /a/a.
(1) why isn't working , (2) logically, want do?
Comments
Post a Comment