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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:27:57+00:00 2026-06-10T15:27:57+00:00

I am going to be doing some basic %{HTTP_HOST} work in my .htaccess file

  • 0

I am going to be doing some basic %{HTTP_HOST} work in my .htaccess file and was wondering if it would be possible to do something similar to this:

RewriteCond %{HTTP_HOST} ((foo|bar|baz).com)$
RewriteCond %{DOCUMENT_ROOT}/apps/%1/webroot%{REQUEST_URI}  -d [OR]
RewriteCond %{DOCUMENT_ROOT}/apps/%1/webroot%{REQUEST_URI}  -f
  RewriteRule %{DOCUMENT_ROOT}/apps/%1/webroot%{REQUEST_URI} [L]

RewriteRule ^(.*)$ index.php?uri=$1 [QSA,L]

basically, if someone visits foo.com on any sub-domain, I want them to be served files directly from that folder but also have any requests that aren’t for specific files sent to my index.php file for processing (which will do the routing)

The reason I am asking is because what I have written above does not actually work, so is there a way to do it? (also if this SHOULD work then it’ll obviously be a problem with the rest of my .htaccess file, but it all works when dealing with just one application folder)

The other (messy IMO) way would be to route everything to the folders and have a second .htaccess file for each domain, but I’d rather not do this if it can be done in one file!

  • 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-10T15:27:59+00:00Added an answer on June 10, 2026 at 3:27 pm

    Your first rewrite rule is missing a regex, which makes the rewrite engine thing you are trying to match (as a regular expression) %{DOCUMENT_ROOT}/apps/%1/webroot%{REQUEST_URI} and you want to rewrite that to [L]. I suspect you want that to look like:

    RewriteRule ^ /apps/%1/webroot%{REQUEST_URI} [L]
    

    The ^ matches anything, since you’ve already vetted the request with your 3 conditions.

    Now you need to add a few conditions to your last rule so that it doesn’t blindly get applied to everything. You probably want something like:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?uri=$1 [QSA,L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm going to be doing some webscraping and my plan is to have something
I am doing some basic SQL Lite database work via a C# application. I
I have been doing some work with polynomials recently evaluating them in basic form
I have a Python 3 script that is going to be doing some regex
I'm doing some basic database learning on Oracle 11g over a Citrix client. The
I've been doing some very basic SNMP4J programming. All I want to do is
Disclaimer: I'm pretty terrible with multithreading, so it's entirely possible I'm doing something wrong.
I am doing a project, it is going to finish but I am facing
I'm doing a project. I'm not going to details but I will simplify my
I am doing a project, where I am going to use Entity Framework 4.1.

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.