I have a PHP script and I'd like to know if it's been executed as a result of mod_rewrite redirecting the request to it.
Is there anything I can easily inspect simply to get a yes or no answer? Is there any way to get 开发者_开发百科the rewritten path rather than the one that was originally requested?
Just do a print_r($_SERVER);
and you'll be able to figure out what you need. On my Apache server:
- Requests redirected through mod_rewrite have a
REDIRECT_URL
parameter - Both
REDIRECT_URL
andREQUEST_URI
point to the originally requested URL - Both
SCRIPT_NAME
andPHP_SELF
point to the actual PHP script
精彩评论