How do I determine if a PHP script I'm running is as a result of mod_rewrite pointing to it?
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_URLparameter - Both
REDIRECT_URLandREQUEST_URIpoint to the originally requested URL - Both
SCRIPT_NAMEandPHP_SELFpoint to the actual PHP script
加载中,请稍侯......
精彩评论