Page 1 of 1

Determining if something is there, or not there.

Posted: Tue Jul 22, 2008 3:27 am
by someberry
I'm not sure how plausible this is, hopefully it can be done but I do not hold my breath. I can't test this out right now since I am at work!

I have a site, say http://www.example.org/page/param.

In some cases the 'page' part will not always be there, but I still need to get both the 'page' and 'param' part. Would something like this work:?

Code: Select all

RewriteRule ^([\w]+)?/([\w]+)         index.php?page=$1&param=$2

Re: Determining if something is there, or not there.

Posted: Sun Jul 27, 2008 11:03 am
by JAB Creations

Code: Select all

<?php if (file_exists("install.php")) {die("boot to the head");?>
Also I think you can avoid using regex (which creates unnecessary load on the server) because it seems you're looking for a static position...

Try looking at some of the various options here...
http://us2.php.net/reserved.variables.server

I also recommend checking this out...
http://us3.php.net/strpos

See that page's "See Also" part (just above the comments). This seems like something you can almost definitely avoid having to use regex with. :D