Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   URL Redirect Question (https://www.warriorforum.com/programming/453720-url-redirect-question.html)

biznics 18th September 2011 09:52 AM

URL Redirect Question
 
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,

maxmalini 18th September 2011 01:29 PM

Re: URL Redirect Question
 
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>

jade69 18th September 2011 01:48 PM

Re: URL Redirect Question
 
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>

SQLMgmt 19th September 2011 08:45 PM

Re: URL Redirect Question
 
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");
}

biznics 20th September 2011 02:56 AM

Re: URL Redirect Question
 
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

biznics 23rd September 2011 02:14 PM

Re: URL Redirect Question
 
Quote:

Originally Posted by upendraets (Post 4736785)
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,

dtang4 23rd September 2011 08:25 PM

Re: URL Redirect Question
 
Quote:

Originally Posted by biznics (Post 4713937)
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.

biznics 24th September 2011 12:03 PM

Re: URL Redirect Question
 
Quote:

Originally Posted by dtang4 (Post 4741536)
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).

cardine 24th September 2011 04:20 PM

Re: URL Redirect Question
 
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! :)

biznics 24th September 2011 08:21 PM

Re: URL Redirect Question
 
Quote:

Originally Posted by cardine (Post 4745731)
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"?

lovenot 24th September 2011 11:16 PM

Re: URL Redirect Question
 
Quote:

Originally Posted by dtang4 (Post 4741536)
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.

GCY 25th September 2011 04:25 AM

Re: URL Redirect Question
 
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. ;)

biznics 25th September 2011 12:56 PM

Re: URL Redirect Question
 
Quote:

Originally Posted by DEaFeYe (Post 4747301)
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,

spabeauty 26th September 2011 04:12 AM

Spa Uniforms
 
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.

rosesmark 26th September 2011 04:33 AM

Re: URL Redirect Question
 
Quote:

Originally Posted by biznics (Post 4702605)
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

gmoney004 26th September 2011 06:57 AM

Re: Spa Uniforms
 
Quote:

Originally Posted by spabeauty (Post 4753715)
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.

cardine 27th September 2011 03:06 AM

Re: URL Redirect Question
 
Quote:

Originally Posted by biznics (Post 4746554)
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"?

I meant the directory you were linking to.

If you are linking to www.mysitelink.com/external then you want to create the index.php file in this directory: /home/yoursite/public_html/external

creativerobert 27th September 2011 03:17 AM

Re: URL Redirect Question
 
Just use the 301 redirect method...

marksz 27th September 2011 08:47 PM

Re: URL Redirect Question
 
or you can always do a dns redirect at your domain DNS settings

DavidWincent 21st October 2011 05:56 AM

Re: URL Redirect Question
 
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");
}

wasabi20 24th October 2011 06:30 AM

Re: URL Redirect Question
 
<? header("Location: http://mynewsite.com"); ?>


All times are GMT -6. The time now is 11:40 AM.