Sub-Domain help

Discussion in 'ASP.NET / ASP.NET Core' started by nitro81nj, Jun 13, 2007.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I purchased sub-domain services from DASP.net, but they give me a script w/ minimal directions. I need to know more indepth directions and where do I input this script. TYVM everyone for your help! :)
     
  2. Thank you so much for your help. Here is the script and directions they gave me. I don't know what exactly to input into the script to mAke it run. Can some give a more indepth instructions and examples?


    Redirect a subdomain to a subdirectory






    The information in this article applies to:

    [*]Subdomain





    DETAILS


    You can redirecta subdomain to a subdirectory by usingASP or ASP.net code.


    When the requests are redirected using anASP file, the URL in browser for redirected domains will show the correct domain name and the directory name where the request is being redirected. You can also redirect the requests to a specific file.


    For example :


    http://subdomain1.YourHostedDomainName.com --> http://subdomain1.YourHostedDomainName.com/subdomain1
    http://subdomain2.YourHostedDomainName.com --> http://subdomain2.YourHostedDomainName.com/subdomain2
    http://subdomain3.YourHostedDomainName.com --> http://subdomain3.YourHostedDomainName.com/subdomain3/home.asp


    The following is a sample script that you can use to redirect a subdomain. You will need to place it as default document on your document root.










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










    NOTE:
    1. Replace subdomain#.YourHostedDomainName.com with your actual subdomain URL.
    2. Replace /subdomain# with your actual subdirectory name
    3. In the last redirection statement in the example, we show how to redirect to a specific file
     
  3. TYVM how do I use the script to redirect to a specific .asp file on my server?
     
  4. If the asp page under question is within a subfolder eg. (mypage.asp is within sub-folder blue) then

    Response.Redirect('/blue/mypage.asp') and similarly others.

    If the page is in the root itself,then it will be

    Response.Redirect('mypage.asp') .Its just the path that will change according to where you want it to re-direct.

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  5. I tried everything you told me.....still no luck...
     
  6. this is what I enter under my index.asp





    <html>
    <head>
    <title>A New Beginning INC</title>
    <script language="javascript" type="text/javascript" src="script.js"></script>
    <link rel="stylesheet" type="text/css" href="style.css">
    <style type="text/css">



    <%
    InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("aisforum.mydomain.com") ) >
    Response.Redirect("ais/forum/default.asp")
    %>
     
  7. You will need to insure that you update UCase('aisforum.mydomain.com') ) to be your domain name. As an example if discountasp incorporates a redirect it will read

    UCase('aisforum.discountasp.net') )
     
  8. The script is just used for redirecting the user to a sub-directory on your site.

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

    Place the above code in your default asp page within the root of your site.What it does is ,checks the requested servername and redirects the user accordingly.
    For Eg,
    Lets say your domain name is www.abcd.com and your sub-domains are 'red.abcd.com' and 'blue.abcd.com'

    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("red.abcd.com") ) > 0 Then
    Response.Redirect("/red")
    ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("blue.abcd.com") ) > 0 Then
    Response.Redirect("/blue")
    %>

    where blue and red are my sub-folders and the above is placed in my default page in the root (lets say default.asp)



    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  9. I'm getting this error now:





    Microsoft VBScript compilation error '800a0414'


    Cannot use parentheses when calling a Sub


    /index.asp, line 10 InStr ( UCase(Request.ServerVariables("SERVER_NAME")), UCase("aisforum.anewbeginninginc.com")) >
    -----------------------------------------------------------------------------------------------^
     
  10. The script will go on top of your startup page that is directly under your webroot. I'm not sure what your startup page is, however it usually is default.asp or index.asp.
     
  11. Try inputting this in your code

    <%

    If InStr( UCase(Request.ServerVariables('SERVER_NAME')), UCase('aisforum.mydomain.com') ) > 0 then
    Response.Redirect('ais/forum/default.asp')
    End If

    %>
     
  12. EVERYTHING I try I get the following when I test the sub domain at aisforum.anewbeginninginc.com:










    Web Page Unavailable

    We're sorry, the web page you are trying to reach is unavailable.

    Please contact the website administrator.

    We apologize for the inconvenience.
     
  13. Can you show us your redirect script again.

    I have also checked the whois record and your domain is not resolving to our DNS server. So after pinging your domain it is not resolving to the correct IP address. If you are going to host your own DNS server, log into your DASP control panel and under DNS manager review your A record. You will need to insure that your A record on your DNS server matches that on our server.
     
  14. What?? Be specific please....what are you talking about?? Step-by-step. The A Record I put in the DNS manager the subdomain to that specific IP to your server. (ie. aisforum.anewbeginninginc.com to the same IPas www.anewbeginninginc.com)
     
  15. my redirect script is at the top of my index.asp file and I'm trying to direct to a file at webroot/ais/forum/default.ap

    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("aisforum.anewbeginninginc.com") ) > 0 Then
    Response.Redirect("/ais/forum/default.ap")
    End If
    %>

    Post Edited (nitro81nj) : 6/17/2007 1:48:16 AM GMT
     
  16. Bruce

    Bruce DiscountASP.NET Staff

    Your script has no problem. The reason why it doesn't work is because the DNS is wrongly set. It looks like you are running your own DNS and the DNS is not properly configured.

    If you are not too familiar with DNS, I recommend you update your domain's DNS to point to our server.



    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  17. Okay I now pointed the DNS of networksolutions.com (who host my domain) to your server. I still am getting the same error when I tried to go to the aisforum.Anewbeginninginc.com :
    <CENTER>













    Web Page Unavailable

    We're sorry, the web page you are trying to reach is unavailable.

    Please contact the website administrator.

    We apologize for the inconvenience.


    </CENTER>


    Now, what do I try to fix this problem??This is starting to getting annoying. I am paying five dollars more month for what? This should not be so difficult to do!
     
  18. Takeshi Eto

    Takeshi Eto DiscountASP.NET Staff

    Well, DNS updates are not instant. It takes about 2-3 days for the update to propogate through the Internet. Please review this knowledge base article on DNS caching: http://kb.discountasp.net/article.aspx?id=10155

    We understand that getting a site functional can be frustrating, but we have only been trying to help here. We are not responsible for improperly set DNS, as only the domain owner can set their DNS.

    Eric
    DiscountASP.NET
    http://www.DiscountASP.NET
     
  19. I am having a similar problem. I am trying to transition my website over to Discountasp from another host/isp and before making the big leap I want to see it running. I have set up a CNAME Alias with my current website host/isp/asp using the url for my default Discountasp account. I do get an error page though that is the same as the previous postings. Can someone confirm the error page here is coming from discountasp: http://www2.ships2day.com/





    If so, then I must just have to tweak my environment to get it going.





    -blammer
     
  20. Just to clarify,you're saying I wouldneed a unique/dedicated IP Address for my DASP Default Domain ? Is this an option/upgrade?

    I chose the CNAME option because all of the documentation I could find indicated that I could enter a domain as an Alias irrespective of an IP Address. Is there an approach you can suggest to someone that is trying to make a smooth transition of theirwebsitefrom a direct competitor of yours?

    -blammer
     
  21. Another direct option would be to have your domain DNS records point toDASP name servers,But if you want to use sub-domains other than 'www','ftp' etc ,you will need a unique IP.

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  22. We have a unique IP with DASP and I have created the cName test.example.com - How do I FTP into this subdomain? Do I have to create a separate Filezilla site address as test.example.com instead of ftp.example.com?
     
  23. Since all subdomains point to the root, it doesn't really matter.

    Just to make things clear...
    http://test.example.com does not equal http://www.example.com/test
    http://test.example.com equals http://www.example.com




    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page