The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Mirroring Multiple URLs, but different homepages?

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
  • #186832

    Hello all –

    Need some advice … and Googling around isn’t helping much because I’m not sure I’m phrasing anything correctly.

    Here’s the situation I have:

    I have FIVE different URLs which need to mirror the exact same site. (Stop laughing) Long story, but a couple of those are just old URLs that we want to keep live … and the other three are the new branding we want to use going forward. I need to have the ability to have any content on the site available using any of the five URLs … so mirroring works perfectly for our needs.

    Oh, important to note that our site is a plain, ol’ manually edited HTML site … no database, no php, no CMS, etc. And the mirroring is done at the domain/host level … not by actually hosting multiple copies of the sites.

    What I’d like to have happen, is have a way to change JUST THE HOMEPAGE differ for a few of the URLs … depending on the URL they typed or followed. All it need be is swapping out one content block with another.

    For example…

    If someone types in or follows a link for … I’d like to have the default homepage.
    If they type or follow … I’d like to have a TWO specific variation of the homepage.
    If they type or follow … I’d like to have the THREE variation homepage.

    Again, this is JUST the homepage.

    Yet, I want ALL OTHER site content to be available by ANY URL … like:

    … would all serve the EXACT SAME PAGE.

    It seems silly, but other than maintaining multiple sites and crosslinking all day long … this is the best solution for us. We need to be able to use different URLs depending on where we need to ATTRIBUTE the content to, on a case-by-case basis.

    I feel like there has to be a script that I can include on just my index.htm page …. something that uses “” perhaps, that will allow me to display different contect blocks … on just that one page.

    Thanks for your time –


    Alright, first off, I don’t think you know what “mirroring” means. What you’re describing is simply pointing URLs at content.

    There’s two parts to what you are describing. First, there is the domain name, which seems to be the biggest part of your issue. If you have several domain names that you want to resolve to the same site, you simply need to change their DNS records to point at your server. In most cases, you can do this yourself via whatever service you registered those domain names with. If your hosting is with a different company, you’ll need to find out the urls for their nameservers first (again, probably available on their control panel or FAQs page).

    The next part is handling specific paths once the user gets to your site. Assuming you use Apache, you can use mod_rewrite to show different pages based on the host name and/or url path. But, in any case, the first step is to get all of the domain names to point at the correct server.


    Hi! Thanks for the reply. Sorry if I’m using the wrong term — “mirroring” is what my host calls it … the DNS setting to resolve to the same site. That part is already in place and working perfectly for all five domain names (four mirrored, one actually hosted).

    I use Dreamhost, so I’m not sure what they use.


    A “mirror” is a server which serves the same content as another —like a “backup” or alternate server for a site that has lots of traffic.

    the DNS setting to resolve to the same site. That part is already in place and working perfectly for all five domain names

    Good. Are you using Apache? Do you know if your host allows you to use .htaccess files? and if mod_rewrite is enabled? (If you don’t know, these are the questions to ask your host.)

    After you figure out these things, we can look at writing RewriteRules to send visitors to specific pages based on the domain name they use.

    BTW, if you haven’t figured it out yet, we won’t be using any javascript to solve this. @TheDoc or @Paulie_D, maybe this should be moved…?


    Aha — that’s a yes. I know I had to edit that in the past to reroute an RSS feed link.


    Alright. Apache sets a variable called “HTTP_HOST”, which is the Host (domain name) requested by the client. So, we can check this to see which domain name was used, and rewrite the URL if it is just the root URL.

    RewriteCond %{HTTP_HOST} domain1example\.com$
    RewriteRule ^$ /domain-1-home-page.html

    untested. Repeat as needed for each domain. Depending on your site structure (i.e., specific names of the domains and pages), there might be a quicker rule.


    Awesome! I’ll set up some tests tomorrow and report back.
    Thanks so much!!


    no problem. Do you understand what this code is doing? You’re likely to get lost otherwise.


    Good Morning –

    Yes, I get the basics here. I just set up a test … and it works perfectly. That said, I do need to figure out one other thing…

    It works great if I try to access:
    However, it doesn’t if I use the full URL of:

    I tried adding a second RewriteCond line, but I don’t know enough of the coding to get the syntax (that the right word?) correct.

    Again, THANK YOU for all of your help with this :)


    However, it doesn’t if I use the full URL

    Right, it only matches an empty URL (e.g., “/”). From your description, it sounded like you wanted all specified URLs to go through normally.

    If you want to catch the index page too, just make it an optional part of the pattern:

    RewriteCond %{HTTP_HOST} domain1example\.com$
    RewriteRule ^(index.html)?$ /domain-1-home-page.html

    Perfect!!! Thanks so much! You just never know how people have bookmarked the site … so including index.htm just covers our bases.

    I think this solves all of my problems …. THANK YOU!!!

Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘Other’ is closed to new topics and replies.