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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:03:35+00:00 2026-06-13T18:03:35+00:00

I am working on multiple projects so I have multiple domains : 1. domain1

  • 0

I am working on multiple projects so I have multiple domains :

1. domain1
2. domani2

how to rewrite for example

domain1/user to domain1/?page=user,

domain2/user to domain2/clientArea/userMain

Now I am using :

   location /user {
     rewrite ^/user$ /?page=user;
   }

but it rewrites all my domains.

P.S : I am new to nginx, and I am using Winginx local server;

  • 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-13T18:03:36+00:00Added an answer on June 13, 2026 at 6:03 pm

    There’s 2 ways to do this depending on whether you have 1 or 2 server-blocks (if you expect lots of configuration differences between the 2 domains use 2, if the 2 domains have mostly the same content use 1)

    in the case of 2 server-blocks config looks like this:

    server {
      server_name domain1;      
      location /user/ { rewrite ^ $scheme://$host/?page=user; }
      # add in rest of domain 1 config
    }
    
    server {
      server_name domain2;
      location /user/ { rewrite ^ $scheme://$host/clientArea/userMain; }
      # add in the rest of your domain 2 config
    

    }

    in the case of a single server-block it would look like this:

    server {
      server_name domain1 domain2;
      location /user/ {
        if ($host = domain1) { rewrite ^ $scheme://$host/?page=user; }
        if ($host = domain2) { rewrite ^ $scheme://$host/clientArea/userMain; }
      }
    }
    

    Note: that you can use the ^ regex as rewrite condition because because the location /user/ block it’s in already selects out the url’s you want to rewrite. That makes it slightly more efficient as the regex will be matched faster.

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

Sidebar

Related Questions

I'm working on a build script with Gradle. We have multiple projects at our
I am working on multiple projects, which most of them have common controllers and
I have projects that multiple developers are working on. We all work off the
I have a program which consists of multiple projects in eclipse (working under ubuntu
I have multiple projects that shares child apps with other projects . When working
I have a project which I am working on and it has multiple files
I have a project which I am working on and it has multiple files
For a project I'm working on I will have multiple servers and lots of
I am working in a Visual Studio 2008 solution with multiple C# projects and
I have a C++ solution in VS2008 with multiple projects. This solution contains files

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.