URL Name and Redirect Help

8 replies
Hi guys,

I need help from professional web developers regarding an issue which is bothering me for days. Here's the problem:

How can I redirect a URL to an external website by having a link-name of whatever I like within my site?

Please have a look at this site: webhostinggeeks dot com (not mine,hehehe)

In the above website, just click any top ten hosting websites under section "Web Hosting Provider". But before you click, check the URL (on mouseover), that it is pointing within the domain (webhostinggeeks dot com/blahblah.html), but when you click it, it redirects to an external website.

I need to the the same thing for my site.

I need to add this URL: websitename dot com/goto-this-site.html within THIS LINK and when it is clicked, it will redirect to an external website(anotherwebsite dot com).

So how can I do it? Is this a simple redirect or does it involve anything else?

Hope I am making a sense.

Thanks,

Ovais
#redirect #url
  • Profile picture of the author dtang4
    The mouseover link is correct. However, all that page does it process some stats (e.g. track the click), then redirect to the external URL. You can do this easily with Javascript...

    e.g.
    <script> location.href = "<external URL>"; </script>
    Signature
    {{ DiscussionBoard.errors[3556488].message }}
    • Profile picture of the author biztrendz
      Originally Posted by dtang4 View Post

      The mouseover link is correct. However, all that page does it process some stats (e.g. track the click), then redirect to the external URL. You can do this easily with Javascript...

      e.g.
      <script> location.href = "<external URL>"; </script>

      Thanks for the input mate.

      Can you please show me the exact example by applying links on the script you've mentioned

      Link I need to add: mylinkname.html
      The link I need to redirect: externalsite.com

      Thanks,
      {{ DiscussionBoard.errors[3560298].message }}
  • Profile picture of the author dtang4
    Sure.

    There are several ways to do it. Here's one (the code below is for mylinkname.html)


    HTML Code:
    <!-- 
    ...
    do stuff like record click
    ...
    -->
    
    <script>
    location.href = "http://externalsite.com";
    </script>
    Signature
    {{ DiscussionBoard.errors[3561279].message }}
    • Profile picture of the author Prodigal
      Originally Posted by dtang4 View Post

      Sure.

      There are several ways to do it. Here's one (the code below is for mylinkname[dot]html)


      HTML Code:
      <!-- 
      ...
      do stuff like record click
      ...
      -->
      
      <script>
      location.href = "externalsite[dot]com";
      </script>
      Just to add a bit here (if i am not wrong):

      this code will only work if the browser has JavaScript enabled

      So, what should be done in case of browsers that don't support JavaScript or block JavaScript :confused:

      Another thing, where exactly do we need to put this code
      Signature
      Affordable Website Design - $149 for custom website design. Contact Us Here
      {{ DiscussionBoard.errors[3590321].message }}
  • Profile picture of the author phpdev
    Also you can use the HTML below

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>Your Page Title</title>
    <meta http-equiv="REFRESH" content="0;url=URL"></HEAD>
    <BODY>
    Optional page text here.
    </BODY>
    </HTML>
    Signature
    Ali Usman
    PHP, MySql, WordPress, API Programming, E-Commerce Site, Payment Integration, Twilio, SMS Marketing, Custom Development, Wordpress, Joomla, Interspire, BigCommerce, Volusion, 3dCart and many more...
    sales@bluecomp.net
    {{ DiscussionBoard.errors[3567950].message }}
  • Profile picture of the author ericsimmon
    use 301 redirect. It's good by SEO point of view.
    {{ DiscussionBoard.errors[3568901].message }}
    • Profile picture of the author Jason Clay
      I recommend using a PHP redirect. Save this code...

      Code:
      <?php
      header('Location: http://www.domaintoredirectto.com/pagetoredirectto.html');
      ?>
      ...as index.php. Just change the URL to the place you want to redirect to. Put the index.php file in an empty directory. For example, if you wanted to redirect to WarriorForum, you could make a directory called warriorforum and put that index.php file in there. If a user went to http://www.yourdomain.com/warriorforum, then that user would be directed to the URL that is specified after the "Location: " part of the index.php file.
      {{ DiscussionBoard.errors[3590026].message }}
  • Profile picture of the author yunie6
    biztrendz, this is what worked for me. (if you find that it worked for u too kindly give me my first thanks!)

    go to your domain root directory (that is where your wp-content, wp-admin folders are), create a folder with the name that you want it to be linked.

    now go open notepad and paste this inside
    PHP Code:
    <?php
    header
    ('Location: http://www.domaintoredirectto.com/pagetoredirectto.html');
    ?>
    save the file as index.php and drag it into that newly created folder.
    {{ DiscussionBoard.errors[3591405].message }}

Trending Topics