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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:01:41+00:00 2026-05-31T14:01:41+00:00

I have a php application that serves multiple customers. Code is placed in the

  • 0

I have a php application that serves multiple customers. Code is placed in the domain’s root and is shared for all customers. Each customer can access it’s page by using query string parameter “id”.

I need advice and a sample code how to achieve this routing via mod_rewrite or it’ better way to do it through php routing script:

Home page:

www.example.com/customerA --> www.example.com/customerA/main?id=1
www.example.com/customerB --> www.example.com/customerB/main?id=4

Note: “main” is main.php file not displaying file extensions.
Customer subfolders are not the real ones.

Inner pages are using additional parameters like:

www.example.com/customerA/page1?id=1&par1=5

On SERVER SIDE all rewrites should be interpreted as www.example.com/main?id=4
without virtual subfolder.

Thanks.

  • 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-31T14:01:42+00:00Added an answer on May 31, 2026 at 2:01 pm

    Here’s what should work:

    RewriteRule ^/customerA /customerA/main?id=1 [QSA,NC,R=301,L]
    RewriteRule ^/customerB /customerB/main?id=4 [QSA,NC,R=301,L]
    
    RewriteRule ^/(customer(A|B))/main /main [QSA,NC]
    

    Now that’s I’ve answered precisely to your question, I’m pretty sure it’s not what you want.
    If you have a lot of customers, I’ve made a huge answer here of a question that was about films, but you it’s about customers, but the principle is exactly the same.


    If you want to be more generic:

    # if URL is not a real file...
    RewriteCond %{SCRIPT_FILENAME} !-f
    # if URL is not a real folder...
    RewriteCond %{SCRIPT_FILENAME} !-d
    # ...and if adding "php" points to a real file...
    RewriteCond %{SCRIPT_FILENAME}.php -f
    # ...then rewrite internally with "php" extension:
    RewriteRule (.*) $1.php [QSA,NC]
    

    Hope this helps.

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

Sidebar

Related Questions

I have a php application that is installed on several servers and all of
I have a php application that has about 50-55 code files. The file that
I have a PHP application that displays a list of options to a user.
I have a PHP application that will on occasion have to handle URLs where
I have a PHP application that makes extensive use of Javascript on the client
I have a PHP application that sends email using the pear Mail function. Unfortunately
I have a php web application that uses big cookies to store a lot
We have a PHP/MYSQL application that collects user input, including special characters like ø,ü,ñ,
I am writing a PHP application that will have the ability to edit settings
I have a LAMP (Linux/Apache/MySQL/Php) application that I should release soon. Even if I've

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.