View Full Version : Multiple Urls to Folders
kevini
12-07-2009, 03:32 PM
Is it possible to have multiple urls, e.g. www.abc.com and www.xyz.com, which resolve to folders of an account, e.g. www.mydomain.com/abc/ and www.mydomain.com/xyz/. I ask this as I am considering setting up a number of small websites for clients, and host them under a single account.
Thanks
Kevin
Ramses
12-08-2009, 05:58 AM
You would be able to add additional domains to your hosting account in the Domain Pointers section of your Control Panel. You'll be able to click on the Order Domain Pointer tab [https://my.discountasp.net/addons/dompointer.aspx] which will allow you to add the domains. You can read more about Domain Pointers in our KB here:
http://support.discountasp.net/KB/a131/domain-pointer-manager.aspx
If you wanted to point the domain pointers to a subdirectory, you could do this by redirecting the domain to a subdirectory, which can be done through code as explained in our KB article here:
http://support.discountasp.net/KB/a369/how-to-redirect-a-subdomain-to-a-subdirectory.aspx
If you're on a Windows 2008 IIS7 server, you can use the URL Rewrite module to make the redirects.
Jarrett
02-11-2010, 02:46 PM
So you can't have multiple sites (different domains) under one account unless you use the above redirection method? In other words, they will never be separate sites in IIS7.
No, they will never be separate sites in IIS. Your site lives in one root directory regardless of how many domains you point to different content within the site/account.
nuclearspike
02-25-2010, 04:34 PM
So you can't have multiple sites (different domains) under one account unless you use the above redirection method? In other words, they will never be separate sites in IIS7.
This may or may not be helpful to your exact needs but I found some info that helped me do what it sounds like your end goal is.
I guess it depends on what you mean by "separate sites". In the technical, strict IIS sense, no, they are all one "site". BUT, as far as the user is concerned, they would **appear** to be two separate sites since they have two different domains (multiple domains can point to one "site" through the domain pointers)
For instance, my primary domain is nuclearspike.com and I bought a domain pointer so that kivabank.com points to nuclearspike root directory.
Using a URL Rewrite in my web.config (not redirection), I make it so kivabank.com is actually running out of the nuclearspike.com/kiva directory. Unlike with redirection, the visitor to the kivabank.com site will never see the nuclearspike.com domain.
Redirection would have taken the user from "kivabank.com" and pushed them over to nuclearspike.com/kiva which is not what I want.
Here's the Rewrite code I used in my web.config (placed inside the <system.webServer> block) After uploading the new config, stop and start your site for the settings to be read:
<rewrite>
<rules>
<rule name="kivabank_com" stopProcessing="true">
<match url=".*"/>
<conditions>
<add input="{HTTP_HOST}" pattern="^(www.)?kivabank.com"/>
<add input="{PATH_INFO}" pattern="^/kiva/" negate="true"/>
</conditions>
<action type="Rewrite" url="\kiva\{R:0}"/>
</rule>
</rules>
</rewrite>
The article where I got the info:
http://weblogs.asp.net/owscott/archive/2010/01/26/iis-url-rewrite-hosting-multiple-domains-under-one-site.aspx
On my server my directory structure is
root\ (all my nuclearspike stuff)
root\kiva (where kivabank.com is served from)
I believe the entry with the negate="true" is there to prevent kivabank.com/kiva from rewriting to itself.
(I just barely switched the nameservers for my domains so those urls may not work if your dns server hasn't been updated yet -- up to a few hours.)
If you ahve more than one domain, just create another <rule> block inside the surrounding <rules> block.
jbm123
03-29-2011, 07:02 PM
I rewrote the code supplied by nuclearspike to redirect a url to a subdirectory in the root of my hosted domain. The placed the Web.config file containing the code (shown below) in the root directory.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<rewrite>
<rules>
<rule name="thebitplayers_net" stopProcessing="true">
<match url=".*"/>
<conditions>
<add input="{HTTP_HOST}" pattern="^(www.)?thebitplayers.net"/>
<add input="{PATH_INFO}" pattern="^/BitPlayers/" negate="true"/>
</conditions>
<action type="Rewrite" url="\thebitplayers\{R:0}"/>
</rule>
</rules>
</rewrite>
</system.web>
</configuration>
When I try to access any site in my hosted domain containing the Web.config file I get the following HTTP error message (500.19):
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x80070032
Config Error The configuration section 'rewrite' cannot be read because it is missing a section declaration
Config File \\?\E:\web\newportlive\htdocs\web.config
Requested URL http://www.thebitplayers.net:80/
Physical Path
Logon Method Not yet determined
Logon User Not yet determined
Any suggestions?
colema18
04-12-2011, 10:39 PM
You want the rewrite node to be in the <system.webServer> node and it looks like you have it in the <system.web> node. This would cause the error message you are seeing.
~james
vBulletin® ©Jelsoft Enterprises Ltd.