0

I want the Request URL to be converted from http://host.com/newname/abc?def= to http://newname/abc?def= here is the config file

server {
    listen 80;
    server_name
        host.com

location / {

    rewrite ^(.+)/$ $1 permanent;
    rewrite ^(.+)/index\.html$ $1 permanent;
    rewrite ^(.+)\.html$ $1 permanent;

      try_files /$host/public/$uri @webserver;
      }
   }

Adding above line worked form me

location / {
            rewrite ^ $scheme://$request_uri? permanent; 
    }

But it replaces the url in user browser which i donn't want to happen. Any way to achieve it

salih
  • 324
  • 1
  • 7
  • 14

1 Answers1

0

You can try this:

location /newname{
  proxy_pass http://example.com/newname/abc?def=;
}

or

location /newname{
  proxy_pass http://newname/abc?def=;
}
Ali Esmailpor
  • 1,209
  • 3
  • 11
  • 22
  • 1
    Thank you @ali-esmailpor But it replaces the url in user browser which i donn't want to happen. – salih Jan 29 '21 at 08:16