Results 1 to 8 of 8

Thread: Redirect question

  1. #1
    Join Date
    Jan 2007
    Location
    Baton Rouge, LA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Redirect question

    This is my first post here. Great site, I've learned a lot here.
    I have a domain that is pointed to another domain that I host. Is there a way in html to redirect someone based on the url that they came to the site from?
    Specifically my domain http://electrimate.com is pointed to my other domain http://bayoucables.com. I would like anyone who comes to the site with the electrimate url to be redirected to a page in a directory in the bayoucables.com site. I get the redirect service way cheaper than having a separate host for it...

  2. #2
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    Just place the following in the page that you want to forward to the other.
    Fill the name of the destination page in the code:

    Code:
    <meta http-equiv="redirect" content="1;url=http://www.destination.com">
    Is that what you were looking for ?

  3. #3
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Quote Originally Posted by chechu View Post
    Just place the following in the page that you want to forward to the other.
    Fill the name of the destination page in the code:

    Code:
    <meta http-equiv="redirect" content="1;url=http://www.destination.com">
    Is that what you were looking for ?
    Just a note, place it between the head tags in the html document.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  4. #4
    Join Date
    Jan 2007
    Location
    Baton Rouge, LA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    No that's not it. My website bayoucables.com is also electrimate.com.
    I want just the folks that come to the url electrimate.com to be redirected, not the ones that come to bayoucables.com. So what I need is some code that will parse the url that the user is using to get to the site.
    Thanks.

  5. #5
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    if you have php enabled on your server, you could do it that way. But if you want just the electrimate.com visitors to be redirected, make a file (lets call it index.html) and place the following code in it:

    Code:
    <html>
    <head>
    <meta http-equiv="redirect" content="0; url=http://www.bayoucables.com">
    </head>
    <body>
    If you are not redirected automatically, click <a href="http://www.bayoucables.com">here</a>.
    </body>
    </html>
    Just put this on the site electrimate.com and not bayoucables.com.
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  6. #6
    Join Date
    Jan 2007
    Location
    Baton Rouge, LA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes, I have php available.
    That's close, but not quite, let me explain it a little further.
    If you go to http://electrimate.com, the name server actually sends you to http://bayoucables.com's server page. It says it's electrimate.com, but it's actually bayoucables.com. I have a link at the top of the main page for electrimate.com that sends you to a directory on the bayoucables.com page that contains the electrimate pages. I just want a way to redirect based on the url that the user entered the site with.

  7. #7
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Try this:

    Code:
    <?php
    
    if ($_SERVER["HTTP_HOST"] == "electrimate.com" || $_SERVER["HTTP_HOST"] == "www.electrimate.com") {
    
    header('Location: http://bayoucables.com/electrimate.com/');
    
    }
    
    ?>
    That should do it.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  8. #8
    Join Date
    Jan 2007
    Location
    Baton Rouge, LA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    By jove, I think he's got it!
    That works great. I put that at the beginning of my html index file and then I had to rename the index.html to index.php.

    Thank you very much!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •