Welcome
Username or Email:

Password:


Missing Code




[ ]
[ ]
Online
  • Guests: 22
  • Members: 0
  • Newest Member: omjtest
  • Most ever online: 396
    Guests: 396, Members: 0 on 12 Jan : 12:51
Members Birthdays:
One birthday today, congrats!
gentoo_daemon (43)


Next birthdays
04/20 gentoo_daemon (43)
04/21 kilovolt (50)
04/21 wannabegeekTC (50)
Contact
If you need assistance, please send an email to forum at 4hv dot org. To ensure your email is not marked as spam, please include the phrase "4hv help" in the subject line. You can also find assistance via IRC, at irc.shadowworld.net, room #hvcomm.
Support 4hv.org!
Donate:
4hv.org is hosted on a dedicated server. Unfortunately, this server costs and we rely on the help of site members to keep 4hv.org running. Please consider donating. We will place your name on the thanks list and you'll be helping to keep 4hv.org alive and free for everyone. Members whose names appear in red bold have donated recently. Green bold denotes those who have recently donated to keep the server carbon neutral.


Special Thanks To:
  • Aaron Holmes
  • Aaron Wheeler
  • Adam Horden
  • Alan Scrimgeour
  • Andre
  • Andrew Haynes
  • Anonymous000
  • asabase
  • Austin Weil
  • barney
  • Barry
  • Bert Hickman
  • Bill Kukowski
  • Blitzorn
  • Brandon Paradelas
  • Bruce Bowling
  • BubeeMike
  • Byong Park
  • Cesiumsponge
  • Chris F.
  • Chris Hooper
  • Corey Worthington
  • Derek Woodroffe
  • Dalus
  • Dan Strother
  • Daniel Davis
  • Daniel Uhrenholt
  • datasheetarchive
  • Dave Billington
  • Dave Marshall
  • David F.
  • Dennis Rogers
  • drelectrix
  • Dr. John Gudenas
  • Dr. Spark
  • E.TexasTesla
  • eastvoltresearch
  • Eirik Taylor
  • Erik Dyakov
  • Erlend^SE
  • Finn Hammer
  • Firebug24k
  • GalliumMan
  • Gary Peterson
  • George Slade
  • GhostNull
  • Gordon Mcknight
  • Graham Armitage
  • Grant
  • GreySoul
  • Henry H
  • IamSmooth
  • In memory of Leo Powning
  • Jacob Cash
  • James Howells
  • James Pawson
  • Jeff Greenfield
  • Jeff Thomas
  • Jesse Frost
  • Jim Mitchell
  • jlr134
  • Joe Mastroianni
  • John Forcina
  • John Oberg
  • John Willcutt
  • Jon Newcomb
  • klugesmith
  • Leslie Wright
  • Lutz Hoffman
  • Mads Barnkob
  • Martin King
  • Mats Karlsson
  • Matt Gibson
  • Matthew Guidry
  • mbd
  • Michael D'Angelo
  • Mikkel
  • mileswaldron
  • mister_rf
  • Neil Foster
  • Nick de Smith
  • Nick Soroka
  • nicklenorp
  • Nik
  • Norman Stanley
  • Patrick Coleman
  • Paul Brodie
  • Paul Jordan
  • Paul Montgomery
  • Ped
  • Peter Krogen
  • Peter Terren
  • PhilGood
  • Richard Feldman
  • Robert Bush
  • Royce Bailey
  • Scott Fusare
  • Scott Newman
  • smiffy
  • Stella
  • Steven Busic
  • Steve Conner
  • Steve Jones
  • Steve Ward
  • Sulaiman
  • Thomas Coyle
  • Thomas A. Wallace
  • Thomas W
  • Timo
  • Torch
  • Ulf Jonsson
  • vasil
  • Vaxian
  • vladi mazzilli
  • wastehl
  • Weston
  • William Kim
  • William N.
  • William Stehl
  • Wesley Venis
The aforementioned have contributed financially to the continuing triumph of 4hv.org. They are deserving of my most heartfelt thanks.
Forums
4hv.org :: Forums :: General Chatting
« Previous topic | Next topic »   

Add-on domains, for the webmasters out there

Move Thread LAN_403
ragnar
Sat Feb 02 2008, 12:26PM Print
ragnar Registered Member #63 Joined: Thu Feb 09 2006, 06:18AM
Location:
Posts: 1425
(Warning, mod_rewrite ahead)

This is a curiosity where after much research, the answer still escapes me.

'Add-on domains' are a service whereby you can register a domain, and invisibly serve content to visitors from a different location, such as a subfolder on your server. This becomes useful if you have only a single webhosting plan tied to a single domain, then decide to register a second domain (say another arm of your business) and serve content apparently from the root directory of that second domain.

For example:
Say you sell widgets. You purchase a webhosting plan, and purchase the domain 'widgets.com', and tie the two together.
If you visit http://widgets.com/, you'll see what's inside the /public_html/ folder, where you would have created content advertising your widgets.

Now imagine you also started to sell tumbleweed. You purchase the domain 'tumbleweed.com', and park it on your webhosting plan.
You visit http://tumbleweed.com/, but you'll see the content in the /public_html/ folder, which is set up to sell widgets! Sure, in links, we could differentiate the sites by putting our tumbleweed site in a subfolder, or giving the index page a different filename, but it's not as neat!

That's where add-on domains come in, for MOST people. What you would probably do is this:
/public_html/widgets/ contains content to sell widgets,
/public_html/tumbleweed/ contains content to sell tumbleweed,
You'd set up add-on domains so that it doesn't matter where your stuff was hosted, and for your visitors, the site would:
invisibly serve http://widget.com/ with content from http://domain.com/widget/, and
invisibly serve http://tumbleweed.com/ with content from http://domain.com/tumbleweed/

This is all good and well; it gives you some portability if you move your webhosting, and to me it makes the most sense structurally, but here's the catch:

Many webhosts will charge monthly fees for 'add-on domains'.

'mod_rewrite' is a powerful part of Apache that allows you to modify how URLs and paths appear on your site. It can be handy if you want to take all the question marks, ampersands and equal signs out of your URLs, or to physically relocate content without affecting its virtual address.

In this case, it's possible to use mod_rewrite to make content behave like it was part of an add-on domain, for example, this code:

RewriteCond %{HTTP_HOST} ^tumbleweed.com$
RewriteCond %{REQUEST_URI} !^/tumbleweed/
RewriteRule ^(.*)$ /tumbleweed/$1

will serve content to visitors from tumbleweed.com, 'invisibly', from http://domain.com/tumbleweed/ (or whichever of your domains your files happen to be hosted on). Those three lines perform the action of an add-on domain.

My big question is:
If you can do this with mod_rewrite, why the hell are hosts charging fees for 'Add-on domains'; why is that 'Add-on domains' button even there in my cPanel?

I've been using mod_rewrite to do this for years, and wondering if there is any reason I should use 'Add-on domains'. Knowledgeable webmasters, please share your insight and enlighten me!
Back to top
Chris Russell
Sat Feb 02 2008, 03:37PM
Chris Russell ... not Russel!
Registered Member #1 Joined: Thu Jan 26 2006, 12:18AM
Location: Tempe, Arizona
Posts: 1052
It cannot be done with mod_rewrite alone. Your webhost will still have to configure apache to serve that particular domain. For example, if you connect to the ip address that hosts 4hv.org (or any other shared server), and ask for the domain tumbleweed.com, which does not exist here, you will only receive the default apache page. This domain does not exist as far as apache is concerned, and it has no way of knowing which account to look in for specific rewrite instructions. It seems unlikely that a webhost would manually configure apache for you rather than using cpanel's addon domain tool, or cpanel's parking tool, and not charge the monthly fee.

Additionally, if your webhost is also handling your dns, they will also need to create a dns entry for that domain on their dns servers. Another thing they are unlikely to do for free. If you're handling your own dns, you can still point the domain at the server that has your account, but that's just the same result as above -- you won't get your content unless your domain is added as an addon or a parked domain.

It may be in some cases that it is cheaper to park a domain that add one one -- sometimes hosts are silly about things like this. There are a few other drawbacks to consider: Using mod_rewrite, php scripts will not be able to determine which host they are on. You also won't be able to set up any email accounts for this domain.
Back to top

Moderator(s): Chris Russell, Noelle, Alex, Tesladownunder, Dave Marshall, Dave Billington, Bjørn, Steve Conner, Wolfram, Kizmo, Mads Barnkob

Go to:

Powered by e107 Forum System
 
Legal Information
This site is powered by e107, which is released under the GNU GPL License. All work on this site, except where otherwise noted, is licensed under a Creative Commons Attribution-ShareAlike 2.5 License. By submitting any information to this site, you agree that anything submitted will be so licensed. Please read our Disclaimer and Policies page for information on your rights and responsibilities regarding this site.