<div dir="ltr"><div>I am trying to rewrite a url in nginx. </div><div><br></div><div>When i am accessing <a href="http://mail.parco.net.pk">mail.parco.net.pk</a> in browser, it opens below link:</div><div><br></div><div><a href="http://mailsvr.parco.net.pk/mailsvr/mail/mailbox.nsf">http://mailsvr.parco.net.pk/mailsvr/mail/mailbox.nsf</a></div><div>But in actual it should open 

<a href="http://mailsvr.parco.net.pk/mail/mailbox.nsf">http://mailsvr.parco.net.pk/mail/mailbox.nsf</a>

</div><div><br></div><div>Below is my nginx conf file.</div><div><br></div>worker_processes  1;<br>worker_rlimit_nofile    30000;<br>events {<br>    worker_connections  1024;<br>}<br><br><br>http {<br>    include                         mime.types;<br>    default_type                      application/octet-stream;<br>    sendfile                   on;<br>    keepalive_timeout           65;    <br>    server {       <br>        listen              80;<br>        return    301     <a href="http://mailsvr.parco.net.pk">http://mailsvr.parco.net.pk</a>$request_uri;<br>        #rewrite ^/mailsvr/(.*) /$1 break;<br>        #rewrite ^/<a href="http://mailsvr.parco.net.pk">http://mailsvr.parco.net.pk</a>(.*)$ <a href="http://mailsvr.parco.net.pk/mail=$1">http://mailsvr.parco.net.pk/mail=$1</a> permanent;<br>        #return    301    http://$host$request_uri;        <br>        #server_name        192.168.17.53;<br>        client_max_body_size    100m;<br><br>        location /{        <br>                #proxy_pass                     <a href="http://172.17.5.157/">http://172.17.5.157/</a>;        <br>                #proxy_set_header     X-Real-IP        $remote_addr;<br>                #proxy_set_header     X-Forwarded-For        $remote_addr;<br>                #proxy_set_header    Host            $host;                <br>                #proxy_set_header    X-Forwarded-Proto    $scheme;            <br>                proxy_read_timeout                240;<br>                proxy_buffering                    off;<br>            }#end location<br>    }#end server<br>   <br>}#end http<br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div>Zeeshan Qaiser Opel</div><div>+92-301-8446630</div></div></div>