hello, how can i use "if" so that if the url someone visits is http://example.com then $number = 1. How can i do this ? hello, how can i use "if" so that if the url someone visits is http://example.com then $number = 1. How can i do this ? Also a second question $page = basename('http://'.$_SERVER['HTTP_HOST'].($_SERVER['REQUEST_URI'] == '/' ? 1 : $_SERVER['REQUEST_URI'])); the above like makes that whatever is after the / becomes the basename. currently it only work if i do http://mydomain.com/index.php/1 how can i make it so only http://mydomain.com/1 would be needed ??
You'll need to use Apache's mod_rewrite function for the syntax http://www.example.com/1/. AddedBytes has a good tutorial on mod_rewrite via a cheatsheet. Alternatively, you could use $_GET (eg, http://www.example.com/?id=1). It may help if you post a little more info, though. What exactly are you trying to accomplish?