[PHP] Best [non-PHP] way to redirect a browser
This is really I guess a non-PHP question, so please excuse... What is the most reliable, browser-safe way to redirect the browser from a default index.html to, say, index.php? The I'm doing it now is with the following javascript: script type=text/javascript language=Javascript document.location=index.php /script And it works, but I wanted to know if any of you are using a better [more compatible] way of redirecting the browser (say, if it doesn't have JavaScript (!?)). ...Rene --- Rene Fournier [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best [non-PHP] way to redirect a browser
You might try META tags. Put this in the head section of your index.html file: meta http-equiv=refresh content=0; url=index.php If the user has JavaScript disabled, you're probably best off using a link and letting the user click through. You may also be able to adjust your Apache or IIS or whatever configuration to load index.php by default, and even eliminated index.html altogether. That's what I wound up doing, and I have experienced no problems. At 10:25 AM 10/26/2001, René Fournier wrote: This is really I guess a non-PHP question, so please excuse... What is the most reliable, browser-safe way to redirect the browser from a default index.html to, say, index.php? The I'm doing it now is with the following javascript: script type=text/javascript language=Javascript document.location=index.php /script And it works, but I wanted to know if any of you are using a better [more compatible] way of redirecting the browser (say, if it doesn't have JavaScript (!?)). ...Rene --- Rene Fournier [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] Sliante, Richard S. Crawford http://www.mossroot.com mailto:[EMAIL PROTECTED] AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupéry Push the button, Max! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best [non-PHP] way to redirect a browser
Before any of your HTML code, put in: header('Location: index.php'); If anything has been sent to the browser yet (through echo/print/etc, or through code outside of the ?php ? tags), though, you will get an error. Mike René Fournier wrote: This is really I guess a non-PHP question, so please excuse... What is the most reliable, browser-safe way to redirect the browser from a default index.html to, say, index.php? The I'm doing it now is with the following javascript: script type=text/javascript language=Javascript document.location=index.php /script And it works, but I wanted to know if any of you are using a better [more compatible] way of redirecting the browser (say, if it doesn't have JavaScript (!?)). ...Rene --- Rene Fournier [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best [non-PHP] way to redirect a browser
René Fournier wrote: And it works, but I wanted to know if any of you are using a better [more compatible] way of redirecting the browser (say, if it doesn't have JavaScript (!?)). If you're using Apache, add 'index.php' to the DirectoryIndex option in httpd.conf. Then you can remove index.html all together -- W | I haven't lost my mind; it's backed up on tape somewhere. + Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 IT Director / SysAdmin / WebSmith . 800.441.3873 x130 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6 http://www.pcraft.com . . .. Boulder, CO 80303, U.S.A. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best [non-PHP] way to redirect a browser
On Friday 26 October 2001 10:25, you wrote: What is the most reliable, browser-safe way to redirect the browser from a default index.html to, say, index.php? The I'm doing it now is with the following javascript: The most reliable, browser-safe, non-PHP way to redirect mail is to do it server-side. If you're using Apache, check out mod_rewrite -- it will do exactly what you're looking for. Otherwise, I believe IIS has similar facilities built into it. --kurt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[Fwd: [PHP] Best [non-PHP] way to redirect a browser]
Right. My bad. Heh, I have an excuse.. it's before noon here ;) Definitely go with the meta approach, then: Example: html head meta http-equiv=refresh content=0; url=index.php / /head body a href=index.phpClick here to enter the site/a /body /html Mike this wouldn't work from an index.html page unless html pages were set up to parse as php file... At 10:35 AM 10/26/2001 -0700, you wrote: Before any of your HTML code, put in: header('Location: index.php'); If anything has been sent to the browser yet (through echo/print/etc, or through code outside of the ?php ? tags), though, you will get an error. Mike René Fournier wrote: This is really I guess a non-PHP question, so please excuse... What is the most reliable, browser-safe way to redirect the browser from a default index.html to, say, index.php? The I'm doing it now is with the following javascript: script type=text/javascript language=Javascript document.location=index.php /script And it works, but I wanted to know if any of you are using a better [more compatible] way of redirecting the browser (say, if it doesn't have JavaScript (!?)). ...Rene --- Rene Fournier [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]