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

  • Home
  • SEARCH
  • 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 8685005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:27:03+00:00 2026-06-12T22:27:03+00:00

Currently I have this piece of code: if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?/$1

  • 0

Currently I have this piece of code:

if (!-e $request_filename)
{
    rewrite ^/(.*)$ /index.php?/$1 last;
    break;
}

This works OK for the following:
example.com/foo redirects to index.php

However example.com/foo?bar doesn’t work. How do you make it work?

FWIW: I don’t experience this problem in Apache’s mod_rewrite equivalent. Basically, I moved a site that works from Apache to Nginx. Now I experience this issue.

Edit:

To be clear here’s what I indent to do:

  • example.com/foo
  • example.com/foo/bar/etc
  • example.com/foo?bar
  • example.com/foo?bar=quz

Should all serve index.php “silently” without changing the URL of the browser’s address bar.

  • 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-12T22:27:05+00:00Added an answer on June 12, 2026 at 10:27 pm

    I just tested it with the following config, and I believe this does want you want:

    server {
    #listen   80; ## listen for ipv4; this line is default and implied
    #listen   [::]:80 default ipv6only=on; ## listen for ipv6
    
    root /home/www/test;
    index index.php index.html index.htm;
    
    # Make site accessible from 
    server_name test.myhost.nl;
    
    location / {        
        # First attempt to serve request as file, then as directory, then fall back to index.php
        try_files $uri $uri/ /index.php?$args;
    }
    
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
        try_files $uri = 404;
    
        # Fix for server variables that behave differently under nginx/php-fpm than typically expected
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        # Include the standard fastcgi_params file included with ngingx
        include fastcgi_params;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_index index.php;
    
        # Override the SCRIPT_FILENAME variable set by fastcgi_params
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    
        # Pass to upstream PHP-FPM; This must match whater you name your upstream connection
        #fastcgi_pass phpfpm;
        fastcgi_pass 127.0.0.1:9000;
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have this piece of code: NSString *strURL = [NSString stringWithFormat:@http://www.sample.com /phpFile.php?firstname=%@,txtfirstName.text]; NSString
I have found this piece of code in the Haskell sendfile package: http://patch-tag.com/r/mae/sendfile/snapshot/current/content/pretty/src/Network/Socket/SendFile/Linux.hsc --
I currently have the following piece of code NSPredicate *pred = [NSPredicate predicateWithFormat:@SELF contains
Currently learning Scheme/Racket and have problem running this piece of code. (if (or (<
I have this piece of code that currently almost does what I need. It
I have this piece of code: $('#contentSites').fadeOut(200, function() { // Animation complete $.get(my_account_content.php?q= +
I currently have this sql statement that I wrote and it works but it's
I currently have this and it works fine but I wanted to have a
I currently have this code which stores XML into an XML-type column called data,
I currently have this code: PACKETS = {}; function AddPacket(data) local id = data.ID;

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.