URL Redirect Question

20 replies
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,
#question #redirect #url
  • Profile picture of the author maxmalini
    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>
    <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.externalsitelink.com">
    </head>
    </html>
    {{ DiscussionBoard.errors[4703538].message }}
  • Profile picture of the author jade69
    If you want to keep that original link you can use a frame redirect script.


    <HTML><HEAD>
    </HEAD>
    <FRAMESET border=0 rows="100%,*" frameborder="no"
    marginleft=0 margintop=0 marginright=0 marginbottom=0>
    <frame
    src="http:/
    www.externalsitelink.com"
    scrolling=auto frameborder="no" border=0 noresize>
    <frame topmargin="0" marginwidth=0 scrolling=no marginheight=0
    frameborder="no" border=0 noresize>
    </FRAMESET>
    </HTML>
    Signature
    {{ DiscussionBoard.errors[4703610].message }}
    • Profile picture of the author SQLMgmt
      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");
      }
      {{ DiscussionBoard.errors[4712328].message }}
      • Profile picture of the author biznics
        Thanks for all the replies guys.

        @maxmalini: About the second method, should I add the directory to the EXTERNAL site? Because I don't have any authority/access to the external site and I only want to add links within my site to be redirected to the external site. Thanks

        @jade69: Please tell me, I have a bunch of links that I want to redirect; so can I add all of them in the same iframe method; you mentioned? And is it search engine friendly? Thanks

        I've seen a site similar to what I require (URL functionality):

        web hosting geeks . com (remove spaces)

        There, you can mouse-over the first link; InMotion. It is redirecting to Business Web Hosting | InMotion Hosting. But the link on the geeks page is actually different than the landing page.

        That is the same redirect method I need.

        Thanks
        {{ DiscussionBoard.errors[4713937].message }}
        • Profile picture of the author dtang4
          Originally Posted by biznics View Post

          Thanks for all the replies guys.

          @maxmalini: About the second method, should I add the directory to the EXTERNAL site? Because I don't have any authority/access to the external site and I only want to add links within my site to be redirected to the external site. Thanks

          @jade69: Please tell me, I have a bunch of links that I want to redirect; so can I add all of them in the same iframe method; you mentioned? And is it search engine friendly? Thanks

          I've seen a site similar to what I require (URL functionality):

          web hosting geeks . com (remove spaces)

          There, you can mouse-over the first link; InMotion. It is redirecting to Business Web Hosting | InMotion Hosting. But the link on the geeks page is actually different than the landing page.

          That is the same redirect method I need.

          Thanks
          Are you referring to the URL displayed in the status bar is different from the actual link? If so, that's something you can do w/ Javascript--i.e. w/ Javascript, you can change the status text to whatever you want.
          {{ DiscussionBoard.errors[4741536].message }}
          • Profile picture of the author biznics
            Originally Posted by dtang4 View Post

            Are you referring to the URL displayed in the status bar is different from the actual link? If so, that's something you can do w/ Javascript--i.e. w/ Javascript, you can change the status text to whatever you want.
            Thanks for the response.

            But wouldn't it be a problem in case user's browser is not supported (disabled javascript).
            {{ DiscussionBoard.errors[4744687].message }}
          • Profile picture of the author lovenot
            Originally Posted by dtang4 View Post

            Are you referring to the URL displayed in the status bar is different from the actual link? If so, that's something you can do w/ Javascript--i.e. w/ Javascript, you can change the status text to whatever you want.
            If this is what you want to do, use iframe definitely.

            However, it is impossible for you to just use scripts like he said. Javascript is NOT able to change the url of your web browser as that would cause a major security issue.
            {{ DiscussionBoard.errors[4747064].message }}
            • Profile picture of the author DEaFeYe
              Banned
              [DELETED]
              {{ DiscussionBoard.errors[4747301].message }}
              • Profile picture of the author GCY
                Hi,

                I would use as well the htaccess method. Yes, you can add as many redirections as you like in the htaccess.
                The advantage in compare with the folder method (and index.html or index.php) is that you have to edit 1 file, when there are changes somewhen. And your file structure is not growing like hell in case you have 100 external links.
                {{ DiscussionBoard.errors[4747809].message }}
              • Profile picture of the author biznics
                Originally Posted by DEaFeYe View Post

                I hate seeing threads repeatedly bumped when the answer is a simple google search away... and also when the 1st response got the answer 100% correct.

                But, maybe if I answer it this way this thread question will die

                You have a site www.yoursite.com

                when you go to that, some file is serving it... in a lot of cases its an index.html or index.php or yatta yatta totally depends on how you're hosting things.

                So... instead of that file, you create one to handle the address:
                www.yoursite.com/external

                or external.html

                or external.php

                or whatever... using whatever tech can even be a straight html page it doesn't matter as long as the link is being served by a page.


                Then, that page should contain the following html when rendered replacing with real data/links as appropriate:

                <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
                <html>
                <head>
                <title>Your Page Title</title>
                <meta http-equiv="REFRESH" content="0;url=http://www.the-domain-you-want-to-redirect-to.com"></HEAD>
                <BODY>
                Optional page text here.
                </BODY>
                </HTML>



                If at this point you need more clarity this forum simply cannot help you. Pick up some reading material about how your site is hosted.
                I must say; this is the response I was waiting for. Thanks a ton mate. Where were you all this time.

                One more thing please (relevant to my thread), the code/method you told me, is this SEO friendly? I mean, creating so many blank/redirection pages? Will Google take it as a SPAM or does Google understands this method already?

                Sorry for newbie question; but the fact is; I am still a newbie when it comes to programming.

                Thanks,
                {{ DiscussionBoard.errors[4749981].message }}
  • Profile picture of the author biznics
    Originally Posted by upendraets View Post

    Just use 301 redirection code for changing URL in your .htaccess file .
    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,
    {{ DiscussionBoard.errors[4739902].message }}
  • Profile picture of the author cardine
    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!
    {{ DiscussionBoard.errors[4745731].message }}
    • Profile picture of the author biznics
      Originally Posted by cardine View Post

      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!
      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"?
      {{ DiscussionBoard.errors[4746554].message }}
  • Profile picture of the author spabeauty
    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.
    {{ DiscussionBoard.errors[4753715].message }}
    • Profile picture of the author gmoney004
      Originally Posted by spabeauty View Post

      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.
      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.
      {{ DiscussionBoard.errors[4754409].message }}
  • Profile picture of the author rosesmark
    Originally Posted by biznics View Post

    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,
    Used this link for your redirect work
    301 Permanent Redirect
    {{ DiscussionBoard.errors[4753801].message }}
  • Profile picture of the author creativerobert
    Just use the 301 redirect method...
    {{ DiscussionBoard.errors[4760524].message }}
  • Profile picture of the author marksz
    or you can always do a dns redirect at your domain DNS settings
    {{ DiscussionBoard.errors[4766489].message }}
  • Profile picture of the author DavidWincent
    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");
    }
    Signature
    Webmaster Studio -A premier web design and internet marketing company in New York.
    {{ DiscussionBoard.errors[4911140].message }}
  • Profile picture of the author wasabi20
    <? header("Location: http://mynewsite.com"); ?>
    {{ DiscussionBoard.errors[4926234].message }}

Trending Topics