Rewrite rules not working

blason nginx-forum at
Thu Nov 10 18:07:23 UTC 2022

Hi Team,

I am trying to write a below rewrite rule but somehow this is not working
and I would really appreicate if someone can help me on this?

I have a website http://web1.example.local/web1
Instead I need a rewrite so that if user enters http://web1.example.local it
will be diverted to http://web1.example.local/web1

server {
        listen 80;
        server_name  web1.example.local;
        add_header X-Frame-Options "SAMEORIGIN";
        access_log /var/log/nginx/web1/access.log;
        error_log /var/log/nginx/web1/error.log;
        rewrite ^ http://web1.example.local

Posted at Nginx Forum:,295715,295715#msg-295715

More information about the nginx mailing list