473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Redirect home page

I have a "new" homepage. How do I automatically direct clients to this new
home page, i.e. when clients enter "OldHomePage.php", they will
automatically be directed to "NewHomePage.php."

Thanks......

Bruce
Jul 17 '05 #1
8 6615

"Bruce A. Julseth" <br*****@attglobal.net> wrote in message
news:3f********@news1.prserv.net...
I have a "new" homepage. How do I automatically direct clients to this new
home page, i.e. when clients enter "OldHomePage.php", they will
automatically be directed to "NewHomePage.php."

Thanks......

Bruce


You need to use the "header" function to send an HTML header line, which
only works if it is sent prior to ANY HTML markup (even a space character in
the wrong place will trigger an error).

File "OldHomePage.php":
<?php
header("Location: NewHomePage.php");
?>

Note the presence of a space character between the colon and the file name
of the new file
Douglas Abernathy
Jul 17 '05 #2
You can use a javascript function that will do this with a timeout, you
can then display a message if you wished.

Jul 17 '05 #3
"Bruce A. Julseth" <br*****@attglobal.net> wrote in message
news:3f********@news1.prserv.net...
I have a "new" homepage. How do I automatically direct clients to this new
home page, i.e. when clients enter "OldHomePage.php", they will
automatically be directed to "NewHomePage.php."

Thanks......

Bruce

Put this anywhere in your PHP on the old page, change content= to the number
of seconds you want to wait before redirecting.:

echo "<META http-equiv='refresh' content='0;
URL=http://www.yournewpage.com'>";
HTH - JM
Jul 17 '05 #4
"Jim Moseby" <no****@dontspam.me> wrote in message
news:vP********************@giganews.com...
"Bruce A. Julseth" <br*****@attglobal.net> wrote in message
news:3f********@news1.prserv.net...
I have a "new" homepage. How do I automatically direct clients to this new home page, i.e. when clients enter "OldHomePage.php", they will
automatically be directed to "NewHomePage.php."

Thanks......

Bruce

Put this anywhere in your PHP on the old page, change content= to the

number of seconds you want to wait before redirecting.:

echo "<META http-equiv='refresh' content='0;
URL=http://www.yournewpage.com'>";
HTH - JM


Correction, this needs to appear in between the <head> </head> tags in the
HTML.

JM

Jul 17 '05 #5
Douglas Abernathy wrote:
You need to use the "header" function to send an HTML header line,
s/HTML header line/HTTP header/
which only works if it is sent prior to ANY HTML markup (even a space
character in the wrong place will trigger an error).
s/ANY HTML markup/any output/
File "OldHomePage.php":
<?php
header("Location: NewHomePage.php");
?>
The Location header field value must be "a single absolute URI"
(RFC2616, sec. 14.30), support for relative URIs notwithstanding.
Note the presence of a space character between the colon and the file name
of the new file


That space character isn't mandatory (RFC2616, sec. 4.2), although
it is "preferred", and such usage is well-established insofar as
it's been adopted by the HTTP standard itself. In fact, any amount
of linear white space (LWS) is permitted before a header field
value. However, semantically speaking, all LWS is equivalent to a
single space (RFC2616, sec. 2.2).

Just for completeness:

CR = <US-ASCII CR, carriage return (13)>
LF = <US-ASCII LF, linefeed (10)>
SP = <US-ASCII SP, space (32)>
HT = <US-ASCII HT, horizontal-tab (9)>
CRLF = CR LF
LWS = [CRLF] 1*( SP | HT )

Elucidating for the ABNF-challenged amongst us, LWS translates to:
an optional carriage-return linefeed sequence, aka "end-of-line
marker", followed by one or more spaces or horizontal-tabs.

--
Jock
Jul 17 '05 #6
Dave Bell wrote:
You can use a javascript function that will do this with a timeout,
Do what?

Anyhow, what if Javascript isn't available or enabled? What if the
"timeout" doesn't give users time to read and process the
information you'll assumably present to them?
you can then display a message if you wished.


A good point.

If you wish to tell users something, such as informing them about
the new URL, then providing a message and a link to the new
document is sufficient; indeed, this method greatly surpasses
sufficiency -- it is superior.

--
Jock
Jul 17 '05 #7
Jim Moseby wrote:
echo "<META http-equiv='refresh' content='0;
URL=http://www.yournewpage.com'>";


Contextually, employing such a pseudo redirect is irresponsible.
The world shall be a better place when mainstream browsers allow
users to seamlessly follow veritable redirects whilst ignoring
those bogosities.

ObPHP: seeing as there're no variables or escape sequences, your
string ought to be quoted with single-quotes, if you really must
echo it at all.

--
Jock
Jul 17 '05 #8
On Fri, 24 Oct 2003 08:41:01 -0400, Jim Moseby wrote:

echo "<META http-equiv='refresh' content='0;
URL=http://www.yournewpage.com'>";

If you have a delay of zero seconds as you are seeing more and more on teh
net. It will give the user a hard time using the BACK option on the
browser.

Never use this F&*&^ posibility.
Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Damo | last post by:
Could someone please help me. I am a newbie at PHP. I downloaded formail.php Version 5.0 from Jacks scripts( http://www.dtheatre.com/scripts/ )and changed the required areas to my email address and...
3
by: Sean Berry | last post by:
Hi there. I am relativly new to Python CGI and need a question answered. I have made custom 404 error pages and have them in various web directories. I have not been able to figure out a way...
3
by: shank | last post by:
I have the following code to redirect users to http://www.mydomain.com/new/default.asp if they use the URL www.newstuff.com (sample). I have that domain name parked on www.mydomain.com. I'm getting...
0
by: Andy Todd | last post by:
Hi We have just moved an ASP.NET application into the live environment which is as follows: Sun Proxy Server / Firewall Windows 2000 Server / IIS5 The URL for the site maps to the Sun...
5
by: PaulThomas | last post by:
Working with XP-Pro and VS.Net I have set my Start Page to "Home.aspx" but the application always starts the "Login" page - - - How can I change the start page to the Home.aspx??? On the login...
1
by: Andy Todd | last post by:
Hi We have just moved an ASP.NET application into the live environment which is as follows: Sun Proxy Server / Firewall Windows 2000 Server / IIS5 The URL for the site maps to the Sun...
1
by: steggun | last post by:
How can I always redirect any user to the "home" page? Basically, a user could enter a full URL in the address bar or bookmark a specific page so that they can go directly to that page. However,...
2
by: Sergej Prokoviev | last post by:
We are running our site at www.waynesavings.com on secure hosting (Server 2003, IIS). We are using a custom 403.4 error page (called 403_4.asp, located under root) to redirect all users to https if...
0
by: omer013 | last post by:
Hi; I have an aspx page with a WebMethod to redirect the user to another page. The Default.aspx.cs is; public partial class _Default : System.Web.UI.Page { public static void...
18
by: Paul Lautman | last post by:
JRough wrote: What do you mean by "redirect the output to Excel"??? Excel isn't a location, it's a spreadsheet program that some (but not all users) will have on their machine. BTW, Location:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.