Web Analytics Made Easy -
StatCounter Redirecting based on domain name, but not changing the address bar? - CodingForum


No announcement yet.

Redirecting based on domain name, but not changing the address bar?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Redirecting based on domain name, but not changing the address bar?


    We have a couple different domain names pointing to our website and some of them go directly to certain folders.

    This is the script I use in my index.asp file to do this:

    PHP Code:
    dim serverName

    inStr(1,serverName,"xxx.com",1)>0 then

    inStr(1,serverName,"yyy.com",1)>0 then

    inStr(1,serverName,"zzz.com",1)>0 then

    message for people who didn't enter either url goes here -->

    end if
    This works fine except when someone types in one of the second or third domain names, they get redirect to the roper folder but their address bar changes to show that they are just in a sub folder of the main site. We'd rather have it keep the domain name that points into that folder. So if I type in www.yyy.com in my browser, ir redirects me to www.xxx.com/abcd but it also puts that in the address bar. I'd rather have it leave www.yyy.com in the address bat and redirect me behind the scenes to www.xxx.com/abcd.

    Then if I click a link to www.yyy.com/filename.htm it could just redirect it to www.xxx.com/abcd/filename.htm.

    Is that possible? If so, could someone point me to somewhere that would tell me how to do it that way instead?m I realize I can't do this in one ASP file since each link would have to point to that file, but is there a setting or something that could be done to make that whole domain just default to starting in a folder and going frmo there?

    Last edited by kelemvor; Mar 9, 2004, 09:27 AM.

  • #2
    2 options I can think of:

    1: Server.transfer. It will basically redirect while leaving the url intact. I think if you leave that page though to click around and move around within the subfolder it will change the url. You could also just use an include statement or server.execute, but that won't leave the page in question, and will execute any code on the page below that spot.

    2. As bad as it may sound, you could use a frameset. The guy who originally did our internet site used frames. The address bar always stays the same, but in the content frame we're moving around between subdirectories.
    This is in spanish when you're not looking.


    • #3

      Frames might actually work. This site is a really small site (maybe 12 pages) and each one has the same link bar across the top which could be turned into a frame. I'll have to give that some thought.... The actual main fram page could live in the root of the main web and it could just pull it's information from the subfolders and such..... hmmmm.


      • #4
        That might be the most painless way, indeed. The pages within the frameset could be from anywhere at all....