URL Redirect Question

by 20 replies
23
I need help in how to get a URL redirected to an external website but keeping the link of my own site (of that external link).

Let me explain it a little:

My Site link I need to redirect: www.mysitelink.com/external
External Site that should open when above link is clicked: www.externalsitelink.com

Now when someone clicks on mysitelink.com/external, I need to redirect the page to www.externalsitelink.com (to a new site).

How can I do it?

Thanks,
#programming #question #redirect #url
  • Well,

    There's a couple of ways to do this. You can always "cheat" and display the link text as www.mysitelink.com/external, but really it will point to www.externalsitelink.com. Here's the HTML code to do this:

    <a href="www.externalsitelink.com">www.mysitelink.com/external</a>


    The other way to do this is if the "external" part of your URL is a directory, then create an index.html file inside that directory with the following content:

    <html>
    <head>

    </head>
    </html>
  • If you want to keep that original link you can use a frame redirect script.


    www.externalsitelink.com
    • [1] reply
    • If you're using ASP.NET, one simple way of doing it is
      create default.aspx under external folder and in the Page_Load event handler, redirect the URL:

      Page_Load()
      {
      Response.Redirect("external_site_name_here");
      }
      • [1] reply
  • Thanks.

    Please clear, can using redirection for so many URLS to different external sites cause any problem; from both; hosting point of view (as I am using shared hosting) and from SEO point of view?

    Regards,
  • Create the following file in the external directory: index.php

    The code of that file should be:
    Code:
    <?
    header("Location: http://whateveryouwantyourexternalsitetobe.com");
    ?>
    That is the standard way of doing this.

    There is no problems with hosting or SEO by doing this. Most sites link out, and using an internal link to do a 301 redirect is not harmful at all.


    Hope that helps!
    • [1] reply
    • Thanks for hoping in mate.

      When you say "Create the following file in the external directory: index.php", what do you mean by "external directory"?
      • [1] reply
  • Banned
    [DELETED]
  • Banned
    [DELETED]
  • If your site is based on .net platform then idon't know how to do 301 permanent redirection. But If your site is based on php platform then you can do 301 permanent redirection with the help of .htaccess file.
    • [1] reply
    • Yes -- it would be helpful knowing what platform you are working in as many of the tools to help you are very different. However, with that said both platforms use .htaccess -- on .NET I would recommend using Helicon ISAPI. It is basically a ISAPI filter that allows your HTACCESS file to be checked before calling IIS. Good luck.
  • Used this link for your redirect work
    301 Permanent Redirect
  • Just use the 301 redirect method...
  • or you can always do a dns redirect at your domain DNS settings
  • Just a simple code you need to insert:

    <a href="www.externalsitelink.com">www.mysitelink.com/external</a>

    If you're using ASP.NET then create default.aspx under external folder and in the Page_Load event handler, redirect the URL:

    Page_Load()
    {
    Response.Redirect("external_site_name_here");
    }
  • <? header("Location: http://mynewsite.com"); ?>

Next Topics on Trending Feed

  • 23

    I need help in how to get a URL redirected to an external website but keeping the link of my own site (of that external link). Let me explain it a little: