ASP code redirect

Discussion in 'Web Design and Development' started by geoffwoollard, Aug 1, 2006.

  1. geoffwoollard macrumors newbie

    Joined:
    Jul 31, 2006
    #1
    Can anyone tell me of a good application that can save a .asp file. I am very new to web development and am trying to get two sites with two seperately registered domains... (with iWeb)... to work on one IP adress. The server hosting we use (crystaltech) has a knowledgbase that explains a bit about a script I have to use

    <%
    sname = Request.ServerVariables("SERVER_NAME")
    sname = ucase(sname)
    if InStr(sname,"DOMAIN1") <> 0 then
    response.redirect "subdirectory to go to"
    elseif InStr(sname,"DOMAIN2") <> 0 then
    response.redirect "2nd subdirectory to go to"
    end if
    %>

    so I put it

    <%
    sname = Request.ServerVariables("SERVER_NAME")
    sname = ucase(sname)
    if InStr(sname,"flcentre") <> 0 then
    response.redirect "D:\inetpub\flcentre\flcentre\Home.html"
    elseif InStr(sname,"jimspostcards") <> 0 then
    response.redirect "D:\inetpub\flcentre\jimspostcards\Welcome.html"
    end if
    %>

    The one thing I am iffy with is the subdirectory to go to ... am I using the right path for this (does it look somewhat right)... or should it look different. Right now all I get (when I use a .htm page with the script) is a page with text and nothing happening. I have teh felling I could be missing something very obvious.
     
  2. JGruber macrumors 6502

    Joined:
    Feb 13, 2006
    #2
    you can do this very easy... on your webhosting, you can do a URL re-direct, which you can say, when http://www.domain2.com is entered, it goes to a directory on the main site. it will look like it is on its own hosting.. I do this with 8 different domain names...

    domain1 - main site
    domain2 - personel site
    domain3 - pre-wedding site

    its all very simple and doesnt require any coding of any.

    You will need to have your domain's setup correctly though.
     
  3. geoffwoollard thread starter macrumors newbie

    Joined:
    Jul 31, 2006
    #3
    how do Ido this URL redirect?
    what do you mean by a directory on the main site? (I am using iWeb)
    how do I set up my domains correctly?
     
  4. JGruber macrumors 6502

    Joined:
    Feb 13, 2006
    #4
    setting up your domains correctly is different through domain registers

    iWeb is just the software to devlope your site, you would need to login to your hosting provider and make the changes there.

    Since your looking for .asp support, I would assume you have Windows based hosting?

    Here is the correct code - copy this code into your default HTML editor and save it as a .aspx file

    Code:
    <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>URL Re-Direct</title>
    </head>
    <body>
    <%
    sname = Request.ServerVariables("SERVER_NAME")
    sname = ucase(sname)
    if InStr(sname,"flcentre") <> 0 then
    response.redirect "D:\inetpub\flcentre\flcentre\Home.html"
    elseif InStr(sname,"jimspostcards") <> 0 then
    response.redirect "D:\inetpub\flcentre\jimspostcards\Welcome.html"
    end if
    %>
    </body>
    </html>
    
     
  5. geoffwoollard thread starter macrumors newbie

    Joined:
    Jul 31, 2006
    #5
    thats another question I have... what defauly HTML editor can I use to save as .aspx? TextEdit, Word for mac?
     
  6. JGruber macrumors 6502

    Joined:
    Feb 13, 2006
    #6
    I'm not really sure if Textedit can save any file as any file extension.
     
  7. spicyapple macrumors 68000

    spicyapple

    Joined:
    Jul 20, 2006
    #7
    Access your CPanel from your web host and do a domain re-direction. Or you can edit the .htaccess file and re-direct that way, although the actual part of how to do it eludes me at this time. Google search for re-direct and .htaccess should yield some fruitful results.

    And I don't think it's possible to have to domain names on one IP address, unless they're just domain-forwards. If both domains have a host, they won't share the same IP address.
     
  8. JGruber macrumors 6502

    Joined:
    Feb 13, 2006
    #8
    Follow these setups...

    1 - Login to your domain name provider.
    2 - Look for Domain Name Setup (DNS specificly).
    3 - Change the DNS servers to your Hosting's DNS Servers.. (dns1.hosting.com & dns2.hosting.com).
    4 - Login to your Hosting CPanel.
    5 - Look for Domain Pointers.
    6 - Add the second domain name (http://domain2.com) and make sure you have it point to a directory on the server, normally it will create the folder from the domain name.
     

Share This Page