Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here



Redirecting my page.

How do I redirect my website to another address?? by cian
Posted: 23 Jan 02

Here are just two simple ways to redirect your page!

1.  This first example is useful if you want to inform your visitor that you have moved.

Into the HEAD section of your page type:

<meta http-equiv="refresh" content="5; URL=http://my new web address">

And into the BODY of your document put

"my old web address"  has moved to  "my new web address"

If your browser does not automatically redirect you in 5 seconds,
click <a href="http://my new web address">here</a> to go to the new site.

2.  The second example using java script is handy if you have a number of domain names (for whatever reason) but want all names to point to the same domain.

Just add this to the top of your document:

<script language="JavaScript">
if( -1 == location.href.
           indexOf('mydomainA.com') )
  location.href = 'http://mydomainA.com';
// -->

The above code will check if 'mydomainA.com' is part of the code and if not will immediately redirect to  'http://mydomainA.com'

Option 2 is best I think unless you want to actually inform your visitor of the change then option 1 can be a good idea.

I apologise for any errors or ommisions.
Questions or feedback would be greatly appreciated.


Back to HTML, XHTML & CSS FAQ Index
Back to HTML, XHTML & CSS Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close