I have a few php files that do a few different jobs. I'd like to change the way my clients access these php files to make it more clean for the end user. The Mod_Rewrite system has shown that it can do some pretty powerful things when in the hands of the right server admin. So I was wondering how far can you abuse the Mod Rewrite rules for a cleaner file system, and pretty URLs. Considering that the PHP files themselves use query strings to get their data, I'd like to alias the way the query string is built based upon how the how deep into the fake files system we go.
Our website's URL is http://www.domain.tld/
, but we shall call it domain.tld
for short. I'd like to map a few different address to a few different query strings on a few different files. But I'd also like to to be expandable on a whim.
Or first set would be, anything going past domain.tld/series/
should be directed to the domain.tld/series.php
script with any (fake) directory past series to become part of the query-string for series.php. The same should happen to anything directed in the direction of domain.tld/users/
that should be redirected to the domain.tld/users.php
file.
So if we had a URLs like, domain.tld/series/Master/2010/
or domain.tld/series/Novice/Season 01/
they would still be redirected to the domain.tld/series.php
script, but with the query-string of ?0=Master&1=2010
and ?0=Novice&1=Season 01
. But should I want to get an overview of the Master series, I could go the the URL domain.tld/series/Master/
and produce the query-string of just ?0=Master
. The idea being that the rewrite rule should allow for infinite expandability.