I've been switching between sections on my website with URL variables. (for example, index.php?section=1) However, I noticed recently that Wikipedia has pages written like this: "index.php/Main_Page".
How does one go about using this sort of thing in php?
Thanks!
URL Variables Using Slashes
Moderator: General Moderators
- MrPotatoes
- Forum Regular
- Posts: 617
- Joined: Wed May 24, 2006 6:42 am
Yep, you can do it without mod_rewrite. Use $_SERVER['PHP_SELF'] with the explode() function and you'll be fine.
P.S Don't forget to sanitize the data before working with it
Edit:
You can also use $_SERVER['PATH_INFO'], but I believe it will work only under Apache and even when you are running Apache, it might not be defined.
Also, the idea of using $_SERVER['PHP_SELF'] will only work under Apache I believe (but not sure).
P.S Don't forget to sanitize the data before working with it
Edit:
You can also use $_SERVER['PATH_INFO'], but I believe it will work only under Apache and even when you are running Apache, it might not be defined.
Also, the idea of using $_SERVER['PHP_SELF'] will only work under Apache I believe (but not sure).