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 4530590
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T13:49:01+00:00 2026-05-21T13:49:01+00:00

I have a rewrite in nginx or Apache for this address: http://domain.com/hello to a

  • 0

I have a rewrite in nginx or Apache for this address:

http://domain.com/hello

to a script like

http://domain.com/test.php&ref=hell

How can I access this rewritten URL in PHP? Because, if I use $_SERVER['REQUEST_URI'] of course I get:

/test.php&ref=hell

but I only want:

/hello

Is this possible? Thanx for help.

Upd nginx cnf

proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

server
{
  listen 80;
  server_name domain.test;


  location /
  {
    rewrite ^/(main|best|air)$ /core/feeds.php?act=$1 last;
    proxy_pass http://127.0.0.1:8080;
  }
}
  • 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-05-21T13:49:02+00:00Added an answer on May 21, 2026 at 1:49 pm

    In Nginx conf, we need to add user header with request_uri:

    proxy_set_header request_uri $request_uri;
    

    And read it in php:

    echo $_SERVER['HTTP_REQUEST_URI'];
    

    upd

    for some reason nginx don’t like symbol ‘_’ in header name, don’t know how it worked before, maybe something changed after nginx update. Now i’m using

    proxy_set_header rewriteduri $request_uri;
    

    and in php

    $_SERVER['HTTP_REWRITEDURI']
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this rewrite rule RewriteEngine On RewriteBase /location/ RewriteRule ^(.+)/?$ index.php?franchise=$1 Which is
I have a rewrite that nginx calls like so: location ~* (css)$ { rewrite
I have a rewrite rule of the following form: RewriteRule ^foo/([a-zA-Z0-9]+)$ foo.php?arg=$1 [qsa,nc] It
I have an htaccess file that uses mod_rewrite to redirect /controller to /index.php?controller=%controller% Like
I see the Nginx HttpRewriteModule documentation has an example to rewrite a www-prefixed domain
I have some mod_rewrite rewrites that correctly redirect the URLs to a script. From
I have Apache with mod_rewrite, and whenever I enter a URI with an accented
Does anyone have experience using the URL Rewrite Module (see here )? Can it
I'm having a problem running Apache + Subversion with SSL behind an Nginx proxy
Now that I have nginx setup I need to be able to hide my

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.