View Full Version : Direct link to site.

02-02-2007, 12:36 PM
I was wondering what the code or direction might be if i someone logged into a site and was directly sent to another site without even noticing.

For example you type in www.yahoo.com and it reroutes you to say www.google.com and the only way you could tell was by looking at the url.

02-02-2007, 01:20 PM
You're not saying what you want code for, which server side technology, or maybe client side?

In PHP you can use 'header' which send a new url to the browser:
header("Location: http://www.example.com/"); /* Redirect browser */

/* Make sure that code below does not get executed when we redirect. */

If you permanently want to send a page to a different url, you can use a .htaccess file if you're using Apache
redirect 301 /old/old.htm http://www.you.com/new.htm

For coldfusion:
<.cfheader name="Location" value="http://www.new-url.com">

<%@ Language=VBScript %>
Response.Status="301 Moved Permanently" Response.AddHeader "Location", " http://www.new-url.com"

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
Response.Status = "301 Moved Permanently";


More here: http://www.webconfs.com/how-to-redirect-a-webpage.php