Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8248159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:06:02+00:00 2026-06-07T23:06:02+00:00

I am experiencing a frustrating redirect from wordpress/nginx when I navigate to a URL

  • 0

I am experiencing a frustrating redirect from wordpress/nginx when I navigate to a URL that does not end in .php. For example after updating something in wordpress, I might be redirect to:

http://www.example.com/wp-admin/options-media.php?settings-updated=true # with blog/ ommited

instead of

http://www.example.com/blog/wp-admin/options-media.php?settings-updated=true 

I am really curious to know why this is happening, and have experimented with the location ~ /blog.* line with numerous variations to no success.

My domain and blog nginx conf files are below, I would really appreciate any help on this!

example.com.conf:

upstream blog {
   server 127.0.0.1:80;
}
server {
  listen 80;
  server_name www.example.com direct.example.com;
  root /home/webapps/example/live/current/public;

  error_log logs/example.com-error.log;
  access_log logs/example.com-access.log;

  passenger_enabled on;
  rails_env production;
  passenger_min_instances 3;
  passenger_spawn_method smart;
  passenger_use_global_queue on;

  location ~ /blog.* {
    proxy_set_header  X-Real-IP  $remote_addr;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    gzip on;
    gzip_min_length  1100;
    gzip_buffers     4 8k;
    gzip_proxied any;
    gzip_types  text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    if (!-f $request_filename) {
      #rewrite ^/blog$     /;
      rewrite ^/blog/(.*)/$ /blog/$1;
      rewrite ^/blog/(.*)$ /$1;
      proxy_pass http://blog;
      break;
    }
  }
}

blog.conf:

server {
    listen      127.0.0.1:80;
    server_name blog.example.com;

    error_log logs/blog-error.log;
    access_log logs/blog-access.log;

    location / {
        root   /home/blog;
        index  index.php index.html index.htm;

        # this serves static files that exist without running other rewrite tests
        if (-f $request_filename) {
            expires 30d;
            break;
        }

        # this sends all non-existing file or directory requests to index.php
        if (!-e $request_filename) {
            rewrite ^(.+)$ /index.php?q=$1 last;
        }
    }

    location ~ \.php$ {
        fastcgi_pass   localhost:9000;  # port where FastCGI processes were spawned
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME    /home/blog$fastcgi_script_name;  # same path as above

        fastcgi_param  QUERY_STRING       $query_string;
        fastcgi_param  REQUEST_METHOD     $request_method;
        fastcgi_param  CONTENT_TYPE       $content_type;
        fastcgi_param  CONTENT_LENGTH     $content_length;

        fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
        fastcgi_param  REQUEST_URI        $request_uri;
        fastcgi_param  DOCUMENT_URI       $document_uri;
        fastcgi_param  DOCUMENT_ROOT      $document_root;
        fastcgi_param  SERVER_PROTOCOL    $server_protocol;

        fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
        fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

        fastcgi_param  REMOTE_ADDR        $remote_addr;
        fastcgi_param  REMOTE_PORT        $remote_port;
        fastcgi_param  SERVER_ADDR        $server_addr;
        fastcgi_param  SERVER_PORT        $server_port;
        fastcgi_param  SERVER_NAME        $server_name;

        # required if PHP was built with --enable-force-cgi-redirect
        # required if PHP was built with --enable-force-cgi-redirect
        fastcgi_param  REDIRECT_STATUS    200;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T23:06:03+00:00Added an answer on June 7, 2026 at 11:06 pm

    I had a similar problem at one point and it turned out that my configuration in the WordPress MySQL Database was incorrect, this was due to me moving the blog from /root/ to /root/blog/.

    This is what I changed:

    Login to the WP DB using PHPMyAdmin or whatever.

    Under wp_options table check the following:

    siteurl    : should be -> http://example.com/blog
    home       : should be -> http://example.com/blog
    remote_url : should be -> http://example.com/blog/
    

    Note the slashes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm experiencing that the drawRect method is called after the modalViewController has shown. Is
Experiencing an issue with an Ubercart 2 store that is now running on nginx.
Currently I am experiencing a frustrating bug in my code. It seems that I
After experiencing it myself, I did a quick search and found that SelectionChanged will
I am experiencing a very frustrating issue when trying to insert a new record
I am experiencing a fatal error while using artisan on the (fantastic) Laravel PHP
At the moment I am experiencing a very frustrating problem. I will try to
After experiencing some performances issues on my client side, we decided to give a
I am experiencing a problem with my circularlinkedlist. it is a list, that is
I'm experiencing a rather frustrating problem. My MVC site runs fine for the most

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.