You are here: Re: [PHP] Best way to do this: www.domain.com?page=var « PHP « IT news, forums, messages
Re: [PHP] Best way to do this: www.domain.com?page=var

Posted by tg-php on 10/04/61 11:37

If you can't set a new 'default page' on your server, using a header('Location: ...') will simulate the same thing.

I believe the web server sends an error "302" (like a "404" when page isn't found) for saying that a page has moved and redirect the browser automatically to the new page.

So like I said, using an index.php containing a header redirect mentioned below is the equivalent of setting a new default page on the web server... minus the "302" server response to the browser.

I believe the original poster was trying to avoid creating a script whose only function was to redirect (via javascript, php, or whatever) so I think the server default page thing is the best solution here.

If you don't have access to that kind of configuration option, then a PHP header() script is a close second choice.

I'd only use the javascript window.location or html meta-refresh techniques as a worst case scenario.

-TG

= = = Original message = = =

I'm confused...
why does everyone use a refresh??? According to me, that's not what a
refresh is supposed to be used for (!). Why don't use a
header('Location: http://www.domain.com/start.php?page=home'); for it?
It's more in-line with RFC's

- tul


Ray Hauge wrote:
> You could also check to see if $_GET['page'] contains a value, and if it does
> not, then redirect it. Something like this:
>
> if($_GET['page'] == '')
> ~header("Refresh: 0; URL=http://www.domain.com/start.php?page=home");
>
>
> Granted that isn't validating the $_GET['page'] variable input for security,
> but that should at least get you going. Also, that assumes that all your
> pages use the GET query to specify which page they are on. If that's just
> for the initial page, then you'd have to do some more qualification.
>
> HTH
>


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация