tags:

views:

48

answers:

1

I want to use htaccess to not only choose the script that processes the request, but also to change the request uri as php sees it. Can this be done?

For example:

RewriteRule /funstuff/ funstuff.php

...How can I change that RewriteRule or otherwise change my .htaccess file to get funstuff.php to think that the original request url was actually http://www.example.com/funstuff.php and not http://www.example.com/funstuff/?

+2  A: 

The best I can see is

$_SERVER["SCRIPT_NAME"] or $_SERVER["PHP_SELF"]

(Both should be fine) in conjunction with

$_SERVER["QUERY_STRING"]

to get the full request. There seems to be no ready-made REQUEST_URI for this.

Pekka
Don't those give the original request url? What I basically want is for PHP to look at REQUEST_URI and see the rewritten url.
Cam
@incrediman awwww, sorry. I totally misread you. Will update my answer.
Pekka
@incrediman updated.
Pekka
Thanks. Is there any way to use .htaccess to change the REQUEST_URI in advance? If not I suppose this will do :)
Cam
@incrediman actually it *might* be possible using `SETENV`, but I wouldn't feel comfortable overwriting a pre-set variable like that even if it were possible.
Pekka
Cam