1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

how to code direct 1 link to another link of website?

Discussion in 'Web Design & Development' started by newbiecom, Oct 25, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. newbiecom

    newbiecom Thread Starter

    Joined:
    Oct 25, 2007
    Messages:
    22
    hi everyone

    I need your help. I have 2 websites, and I would like to link from website 1 to website 2. for example, when I search engine for my website 1, and it appear on search engine site. Then I click on website 1 link, it will transfer automaticaly to website 2. Please help me anyone if you know tell me how to do it. or you have know how to code it..please show me how.
    Thank you very much.

    Phil
     
  2. TheRobatron

    TheRobatron

    Joined:
    Oct 25, 2007
    Messages:
    551
    To achieve yourr desired effect you will have to build a redirect page. I'm a bit new to doing these, so I hope it works.

    First, go into notepad and make a file called ".htaccess" (make sure it is called exactly that and if notepad adds ".txt" to the end, go into My Computer and change the name back.)

    Open the file for editing. Inside, put this:

    Code:
    redirect 301 /old/old.htm http://www.new.com/new.htm
    You must put that exact code into the file, apart from changing "old" and "new" to your old site and the site you're redirecting to. Make sure the files "old.htm" and "new.htm" have the right names and file extensions.

    When you've done that, upload the file to the same level as the page you are redirecting from on your old server. The "redirect 301" tells the browser that the site has been permanently moved.

    I hope it works.:p
     
  3. newbiecom

    newbiecom Thread Starter

    Joined:
    Oct 25, 2007
    Messages:
    22
    thank you so much TheRobatron. I will try see it work o not and let you know later.
    thanks again.

    Phil
     
  4. newbiecom

    newbiecom Thread Starter

    Joined:
    Oct 25, 2007
    Messages:
    22
    redirect 301 /www/index.html http://www.way-o-breath.com/index.html

    this is a code I just set inside the file of .htaccess , but the redirect site is not work. do you have any idea, please help me. Thank you very much.

    Phil
     
  5. TheRobatron

    TheRobatron

    Joined:
    Oct 25, 2007
    Messages:
    551
    I've found the problem (hopefully). It was due to my explanation. Put the file into the root (top) folder on your server. Then put in the code you did before, but slightly differently:

    Code:
    redirect 301 /[B]filepath[/B]/index.html http://www.way-o-breath.com/index.html
    The filepath should be substituted for the filepath that you have to take to get from the root of the server to index.html.

    Hope that works.

    Rob
     
  6. newbiecom

    newbiecom Thread Starter

    Joined:
    Oct 25, 2007
    Messages:
    22
    I don't really sure you said "the filepath should be substituted for the filepath that you have to take to get from the root of the server to index.html" can you tell me more clearly and simply to understand or can you give some examples. Please. Thank you very much Rob

    Phil
     
  7. KimbH

    KimbH

    Joined:
    Oct 5, 2007
    Messages:
    32
    Does it matter what your htaccess permission is set on?

    I can't seem to get this working correctly no matter which file path I use.

    Thank you
     
  8. newbiecom

    newbiecom Thread Starter

    Joined:
    Oct 25, 2007
    Messages:
    22
    I tried it..but not working. Do you have any idea differently KimbH?
    Thank you for reply.
     
  9. newbiecom

    newbiecom Thread Starter

    Joined:
    Oct 25, 2007
    Messages:
    22
    thank you Rob. your code is working now..
    "redirect 301 index.html http://www.way-o-breath.com/index.html". but it take a bit longer time to redirect (20 seconds). you have any idea to redirect faster?
    thank again so much

    phil
     
  10. KimbH

    KimbH

    Joined:
    Oct 5, 2007
    Messages:
    32

    I used the htaccess with redirect 301 /old/old.htm http://www.new.com/new.htm however it would not work in the mail root. I figured out the problem was I was trying to redirect a sub-domain so I had to put that in redirect 301 in the sub-domains' htaccess.

    Hope that helps
     
  11. TheRobatron

    TheRobatron

    Joined:
    Oct 25, 2007
    Messages:
    551
    Here's an alternative to using the 301 redirect:

    Put this code in "index.html" of the old site:
    Code:
    <html>
    <head>
    <script type="text/javascript">
    <!--
    function delayer(){
        window.location = "http://www.newsite.com/newpage.htm"
    //-->
    </script>
    </head>
    <body onLoad="setTimeout('delayer()', 5000)">   [I]Change the 5000 to 0 for an immediate redirect[/I]
    <h2 >Prepare to be redirected!</h2>
    <p>This page is a time delay redirect, please update your bookmarks to our new 
    location!</p>
    
    </body>
    </html>
    
    FYI I didn't write that - I found it on the net :p (I'm not that good at javascript!)
     
  12. newbiecom

    newbiecom Thread Starter

    Joined:
    Oct 25, 2007
    Messages:
    22
    thank you very much Rob, and everyone. My website redirected now. It worked. Thank you.
     
  13. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/643564

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice