Ricky Romaya wrote:
Can I have somekind of URL rewriting mechanism without
touching the web server's configuration (implemented
in pure PHP) and win32 compatible?
Not really... URL rewriting is a pretty low-level HTTP
server functionality... This said, there may be ways
to make your URLs shorter and prettier...
For example, this URL:
http://www.foobar.com/en/my-index/
will be translated to
http://www.foobar.com/index.php?lang=en&page=my-index
before the webserver finally calls index.php with
'lang' and 'page' arguments.
Again, URL rewriting is out of question, so what I am about
to suggest is more like alternative ways of communicating
values without communicating names.
There is a hack (which I really don't recommend because I am
not sure this Apache behavior is intended)... Call your home
page like this:
http://www.foobar.com/index.php/en/my-index/
This should set your $_SERVER['PHP_SELF'] to "/en/my-index/",
which you can then parse like this:
$vars = explode('/', $_SERVER['PHP_SELF']);
$lang = $vars[1];
$page = $vars[2];
There is another hack, more standards-friendly:
http://www.foobar.com/?en/my-index/
This should set your $_SERVER['QUERY_STRING'] to "en/my-index/"
which you can parse like this:
$vars = explode('/', $_SERVER['QUERY_STRING']);
$lang = $vars[0];
$page = $vars[1];
Cheers,
NC