Site icon Hip-Hop Website Design and Development

WordPress login redirection not engaged on Nginx root listing

i’ve a wordpress web site which redirects me to earlier web page from the place login is requested. it really works completely effective on apache net server and accessible on http://localhost/wp and when i moved from apache to nginx additionally it is working effective in nginx subdirectory(/var/www/html/wp) i.e http://localhost/wp. however when i deployed the location on nginx root listing i.e /var/www/html/ the login redirection cease working and caught on login web page.
Can somebody determine what i’m doing flawed in configurations or in redirect code.

subdirectoy working effective:

http://localhost/wp/gallery —-> http://localhost/wp-login.php —-> redirects to —> http://localhost/wp/gallery

From root listing:

what i need

http://localhost/gallery —-> http://localhost/wp-login.php —-> redirects to —> http://localhost/gallery

what it does

http://localhost/gallery —-> http://localhost/wp-login.php —-> redirects to—> http://localhost/wp-login.php

redirect operate code right here :

session_start();
 if(wp_get_referer() != get_site_url()."/wp-login.php"){
    $_SESSION['back_log'] = wp_get_referer();
 }
 operate admin_default_page() {
    $back_log = "";
    if(isset($_SESSION['back_log']) && !empty($_SESSION['back_log'])) {
        $back_log = $_SESSION['back_log'];
        return $back_log;
    }
 }
 add_filter('login_redirect', 'admin_default_page');

cofigurations are given

 server {
        hear       80;
        server_name  localhost;
        client_max_body_size 64M;
        #proxy_max_temp_file_size 0;
        #proxy_buffers 16 16k;  
        #proxy_buffer_size 16k;

        root html/;
        index  index.php index.html index.htm;


        location = /favicon.ico { log_not_found off; access_log off; }
        location = /robots.txt { log_not_found off; access_log off; permit all; }
        location ~* .(css|gif|ico|jpeg|jpg|js|png)$ {
        expires max;
        log_not_found off;
        }    

        location / {
                try_files $uri $uri/ /index.php$is_args$args ;
                
            location ~ .php$ {
                try_files $uri =404;
                fastcgi_pass   127.0.0.1:9999;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                embrace        fastcgi_params;
            }
        }
   

        location /wp {
        root html/wp;
        try_files $uri $uri/ /wp/index.php$is_args$args;
        
        }
        
        location ~ .php$ {
        fastcgi_pass   127.0.0.1:9999;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        embrace        fastcgi_params;
        }

    }