Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forwarding to a page 1

Status
Not open for further replies.

perrymans

IS-IT--Management
Nov 27, 2001
1,340
US
I have a new domain, and I want the home page to be inside the domain like:

domain.com (main domain)
domain.com/portal (where I want everyone to be redirected when they enter
How do you redirect people? Wihtout telling them?

Thanks. Sean.
 
code in (presumably in index.html):

Code:
<html>
<head>
<script>
document.location = '[URL unfurl="true"]http://www.domain.com/portal';[/URL]
</script>
</head>
</html>

I visit pages all the time that redirect automatically. I can tell because I see the URL change in the address bar, but no one "tells" me anything.

Is that what you mean?

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
The problem with that method LFI is that being client side it can fail or be bypassed easily.

If you really must do it client side then there is nothing really wrong with a meta refresh tag, providing it is done "right".

Dan's suggestion to do it server side, via a php header(); function, an ASP Response.Redirect or even an Apache .htaccess directive is much more robust.

You should also look to telling the requesting page that the change in URL is permanent (301) redirect.

This page might be useful to you:




Foamcow Heavy Industries - Web design and ranting
Buy Languedoc wines in the UK
 
...and the 10-15% of visitors without JS enabled will see...?


Nothing!

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
how about this?
Code:
<html>
   <head>
   <meta http-equiv="Refresh"
   content="0;URL=http://www.google.com">
   </head>
</html>
 
Just to clarify why I advised to go server-side, JavaScript and search engines aside... We had no idea what server software the poster has - so could not assume that index.html was set up to be displayed when no filename was specified.

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top