Point domains to subdirectories

Discussion in 'Site Programming, Development and Design' started by Solomondial, Dec 20, 2009.

  1. Hi folks,

    I just signed up today for a brand new account.
    I have one main asp.net website with a MS SQL DB and
    8 domain names with regular HTML.
    the 8 domain names need to each have their own subdirectory,
    and the script to point them to these subdirectories.
    Right now, I have gotten them all loaded into the domain name pointer.

    The only script I have found is to point subdomains to a subdirectory.
    Can the 8 domains simply replace the subdomains in the following KB article:

    http://support.Winhost.com/KB/a649/how-to-redirect-a-subdomain-to-a-subdirectory.aspx

    I also need to know two more things, if you please, which I have not found an answer to...
    1) How do I create the subdomains? (where is that done)
    2) Where do I put the script that will enable these domains to be directed to their respective subdirectories of the main site?

    thanks a lot for any help

    Sol
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    Yes, the KB article for the redirect script should also work with full domain names rather then subdomain names.


    1) How do I create the subdomains? (where is that done)

    Subdomain names are created inside your Winhost control panel under the Site Info Manager/Subdomain Manager.

    https://cp.Winhost.com/sites/subdomain.aspx

    2) Where do I put the script that will enable these domains to be directed to their respective subdirectories of the main site?

    You will typically type the script at the top of the default page in your root. The default startup page is usually default.aspx, default.asp, index.aspx and so on....
     
    Last edited by a moderator: Oct 14, 2015
  3. Thanks Ray.

    1) How do I create the subdomains? (where is that done)

    Subdomain names are created inside your Winhost control panel under the Site Info Manager/Subdomain Manager.

    Ray, If I go into that, it is becoming a little clearer to me why this hasn't made sense. it's because it's not a very good system. No offense to anyone.
    It's just that, in order for me to use another domain and have it's own folder to act as a standalone, i have to add it as a subdomain of my main site.
    There are no other options in the Subdomain manager.

    my main site is www.main.com.
    now, i have another completely different website i want to host and it's called, for example, www.secondsite.com.

    So now, I have to go to subdomain manager and add -

    secondsite.main.com -

    this really doesn't make sense.
    But i think in the end, it should all work out if i point
    www.secondsite.com - to that subdomain site in the script, the
    browser should still just see in the window "www.secondsite.com"
    correct?

    How will I know the exact subdirectory path to point my script to?

    if i add, secondsite.main.com -
    what about the domain extension?
    i cannot add secondsite.com.main.com - correct?

    confused.

     
    Last edited by a moderator: Oct 14, 2015
  4. Ray

    Ray

    You're confusing subdomain with domain pointers. Subdomains are extensions of the original domain name. As an example if you have a domain mydomain.com a subdomain will be subdomain.mydomain.com. Notice that the last two parts is mydomain.com. This is the domain name. If you want to set another domain name to point to mydomain.com such as mydomain2.com then you will use a domain pointer not a subdomain name. Remember the two are totally different. Look at this kb article for the domain pointer features.

    http://support.Winhost.com/KB/a696/details-on-domain-pointer-service.aspx
     
    Last edited by a moderator: Oct 14, 2015
  5. Ray,

    I am fully aware of the difference between domain name and a subdomain. What I am trying to do is navigate the way to get my stand alone domains, which are not the main account domain, to have their own hosted websites under subdirectories under the main domain account.
    Before I signed up, I was told I can do that.
    So far, I have found nothing that can enable me to do so, except to try to add a subdomain -

    Let me explain the situation again.
    I have a main website - www.main.com

    And I have 7 other domain names which each were previously hosted on another service provider, and they each had their own FTP, their own folders, so that they were unique, stand alone websites.

    I need to now create the subdirectories in my main account which will enable me to point my 7 domains each to their own respective subdirectory, so they can each be hosted as their own website.
    I specifically asked if this was possible and told it was.
    So far, I have not been given very clear answers at all and the KB
    articles do not explain how to do this.

    Was I misled by sales before I signed up? Ie - is it impossible what I want to do??

    Or, if not, HOW do I do it?

    Thanks for a clear, step by step answer - this is something that could use some clarification and improvement for sure.

    Sol
     
  6. Ray

    Ray

    Sol,

    Each site account will only have web space, one email domain (which means an email account), and one FTP account. Albeit you can create multiple FTP users, you basically have one FTP account.
    From what you describe, I think you had the impression that you can point several domain name to one site account, and get all the features that a site account has.

    application pool
    Email,
    Web space,
    SQL database
    FTP

    unfortunately this is not the case. What we do have is a domain pointer feature like I mentioned before. What the domain pointer do is to point additional domain names to the root directory of your site account. Then you can use redirect scripts/redirect rules to force those additional domain names that originally points to your root to specified directories of your choice. If what you want for these additional domain names to have it's own...

    application pool
    Email,
    Web space,
    SQL database
    FTP

    ...then you will need to register them as there own site account. Which of course will incur a site service fee of $4.95.
     
  7. Hi Ray,

    Thank you.
    Again, I did understand correctly from sales before sign up that the additional domains pointing to their own subdirectories would not have their own FTP and email accounts and won't have their own application pools - though the domains can have email addresses that will point toward the main email account. that's fine and what I expected.

    <<unfortunately this is not the case. What we do have is a domain pointer feature like I mentioned before. What the domain pointer do is to point additional domain names to the root directory of your site account. Then you can use redirect scripts/redirect rules to force those additional domain names that originally points to your root to specified directories of your choice.>>

    That is what I need to do.
    Since the main site does need its own database and application pool, it had to be the main site. the other sites are simple HTML files and do not need their own application pool.

    So, where I am now, is that I have all the domains all set up in the domain pointers fine. When I put them all in the browser window, I am getting the
    Winhostdefault.htm file. so they're set up right.

    What i need to do now, is to be able to create the subdirectories where i will put all the files for each of the domains and to create the script in the default.aspx file to point these domain names to those subdirectories.

    After all the reading i've done, i still do not understand how to create the subdirectories...

    also, what is the ("SERVER_NAME") variable in the script to enable this functionality for domain name pointing to subdirectories?

    Moshe
     
    Last edited by a moderator: Oct 14, 2015
  8. Ray

    Ray

    Last edited by a moderator: Oct 14, 2015
  9. Aha! Wonderful Ray!
    That was an important piece of the puzzle I did not find anywhere previously.

    Now, what about the "SERVER_NAME" variable in the script?
    I didn't get any info on my server name in the welcome emails.
    Did I?

    <% If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain1.HostingAccountDomain.com") ) > 0 Then Response.Redirect("/subdomain1") ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain2.HostingAccountDomain.com") ) > 0 Then Response.Redirect("/subdomain2") ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain3.HostingAccountDomain.com") ) > 0 Then Response.Redirect("/subdomain3/home.asp") End If %>

    Thanks again

    Sol
     
  10. Ray

    Ray

    Leave the SERVER_NAME alone. That will catch the http call. What you want to change is...

    UCase("subdomain1.HostingAccountDomain.com")

    ...you should change it to something like...

    UCase("2nddomain.com") > 0 Then Response.Redirect("/folder1")
     
  11. Why not use the url rewrite module in IIS instead of the redirect script it works a lot better and doesn't give the search engines or end user a 301 redirect message?
     
  12. Ray

    Ray

    I agree although the URL Rewrite Module itself can be confusing depending on how complex you want the rules to be.
     
  13. Ray, thanks for all the help.
    Gabriel93, good suggestion. Wish that had been suggested earlier.
    I did manage to get everything working... now I have the nightmare to update all the links on my huge sites, with many pages, because now I have subdirectories that I have to point to in the links. errrr.... any ideas for a fast fix for this? Maybe a script or something?

    Next question I have is about the emails -
    I activated the emails for the domain pointers...
    I have many of them. I understood from a KB article, that if I want to use, for instance, Sol@domain2.com, that I have to have sol@mymaindomain.com -

    Do I need to set up sol@domain2.com or if someone sends an email to that address, it will automatically be forwarded to my sol@mymaindomain.com?

    And... more importantly, HOW and WHERE do I set up sol@mymaindomain.com - right now, i just have postmaster@mymaindomain.com

    And... I would like to forward all emails being send to @mymaindomain.com to my gmail account. How can I do that?

    Thanks for your help...

    Sol
     
  14. Ray

    Ray

    For you first question. Unless you have some sort of master template I'm afraid you'll have to go through each page one at a time and update the links. Sorry, all I can say is proper web design is important; albeit it can be time consuming and annoying.

    As for your domain pointer alias; you do not need to create any domain pointer email address. As long as you have an email address sol@mydomain.com, any one who emails sol@domain2.com will automatically route the email to sol@mydomain.com.

    To create POP accounts try looking into this kb article.
    http://support.Winhost.com/KB/a695/how-to-create-a-new-email-address.aspx
     
    Last edited by a moderator: Oct 14, 2015
  15. Thanks Ray. Got it!
    It's done, and I found the forwarding option in the Webmail...
    great!

    Moshe
     
  16. Browser Address bar

    Read this series of messages with interest and found many answers. However, I am still wondering what the visitor will see int the browser address bar as he/she moves around to different pages from secondDomain.com. Will SecondDomain.com/otherpages.aspx appear or will the URL be related to the mainDomain?
     
  17. So does anyone actually have an answer for this? It would seem to me that without Host Headers in place the user would always see the subfolders/files appended to the root domain?

    What am I missing?
     
  18. Ray

    Ray

Share This Page