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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:50:18+00:00 2026-05-28T13:50:18+00:00

I have some domains that all redirect to the same folder (my public_html). I’d

  • 0

I have some domains that all redirect to the same folder (my public_html). I’d like to write an .htaccess file that would send each domain to it’s own folder (thus not displaying this on the navigation bar).
For example, navigating to http://example.com would load the folder /public_html/example.com/ of my server.

In another context, I’ve used this code:

RewriteCond %{HTTP_HOST} example\.com$ [NC,OR]
RewriteRule ^(.*)$ http://www.anotherdomain.com/$1 [R=301,L]

But now I don’t want to redirect to another domain; I just want to fetch the files from a different folder…

Is it achievable? Thanks in advance.

  • 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-28T13:50:19+00:00Added an answer on May 28, 2026 at 1:50 pm

    Replace what you have with:

    RewriteCond %{REQUEST_URI} !^/%{HTTP_HOST}/ [NC]
    RewriteRule ^(.*)$ /%{HTTP_HOST}/$1  [L]
    

    For explicit host redirects:

    RewriteCond %{HTTP_HOST} example\.com [NC]
    RewriteCond %{REQUEST_URI} !^/example.com/
    RewriteRule ^(.*)$ /example.com/$1  [L]
    
    RewriteCond %{HTTP_HOST} otherexample\.com [NC]
    RewriteCond %{REQUEST_URI} !^/abc/otherexample.com/public_html
    RewriteRule ^(.*)$ /abc/otherexample.com/public_html/$1  [L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to redirect all urls from the webpage (what ever what's after
I have two different domains that both point to my homepage in the same
I have some files placed under a particular folder in my old domain like
Assume some domain and view objects (that have no common base class) public class
I have some pdf files located on a http server: Like: http://domain.com/files/file1.pdf http://domain.com/files/file1.pdf http://domain.com/files/file1.pdf
I have some UI in VB 2005 that looks great in XP Style, but
Just writing a little function here and need some optimisation help! All requests redirect
I need to match all urls that DO have mydomain.com in them AND DO
I have some 1and1.co.uk webspace and a handful of domains. This is grand and
I have the following page: www.domain.com/index.php?route=information/contact and I'd like to rewrite it so that

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.