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 Ray Hauge on 10/04/06 11:37

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

--
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
http://www.americanstudentloan.com
1.800.575.1099

On Monday 16 January 2006 03:14 pm, tg-php@gryffyndevelopment.com wrote:
> On your web server you can configure 'default pages'. Apache and *nix type
> servers seem to favor the "index.html" type default pages while Microsoft's
> IIS goes for the "Default.htm" just to be different. But you can add
> default pages to a list in the order you want them accepted.
>
> For instance, if you use PHP a lot (which I think we all do :) but you have
> a lot of directories that just have static HTML in them, you might have:
>
> index.html
> index.php
>
> (or vice versa) as your default pages list. If it doesn't find any of
> those in the directory being accessed, then you should get your good old
> 404 error.
>
>
> Should just be a matter of adding "start.php" to your defaults list in
> whatever priority order you want.
>
>
> I think that'll do it for ya. If you're going through an ISP, they still
> may have a way that you can set your defaults, possibly through .htaccess
> or some other Apache type prefs setting mechanism.
>
> Good luck!
>
> -TG
>
>
> = = = Original message = = =
>
> Hello,
>
> What would be the best way to get a page variable like this:
>
> www.domain.com?page=home
>
> to show up when a user types in:
>
> www.domain.com
>
> My current fix is to have this:
>
> header("Refresh: 0; URL=http://www.domain.com/start.php?page=home");
>
> .. on a index.php page on the root..
>
> Is there a way I can do this and avoid having a page that just does
> redirection?
>
> Thanks for help.
> Cheers,
> Micky
>
>
> ___________________________________________________________
> 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

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