Could i get the apache mod_rewrite definition of urlbase via php scripting?
+1
A:
You can get the requested URL via $_SERVER['REQUEST_URI']
and you can get the full path of the current PHP file via the magic constant __FILE__
. From these 2 variables you could extrapolate RewriteBase
however there may be situations where this is not possible.
It might help if you explain why you need access to RewriteBase
.
rojoca
2010-03-23 10:45:20
Well thanks for your reply, i tried something similar i make a lookup for pathinfo, if not exists i explode SCRIPT_NAME by / array_pop script file and then implode again and replace to my request uri, actually seem to work, but i don't know how it will work in other environments
markcial
2010-03-23 10:59:23
A:
Here is my workaround, if anyone knows any better i ll be glad to know, and i'll patch my file inmediately :P
$scriptName = explode("/",$_SERVER["SCRIPT_NAME"]); array_pop($scriptName); $folder = implode("/",$scriptName); $pathInfo = str_replace($folder,"",$_SERVER["REQUEST_URI"]);
Thanks @rojoca for the hint!
markcial
2010-03-23 12:42:39