I have a piece of PHP software that does beautifull things with mod_rewrite. But the same software should run on a server where mod_rewrite isn’t installed. Can I check in my php code if mod_rewrite is installed AND if a certain rule is applied?
For example, something like this:
if ((mod_rewrite is enabled) and (mod_rewrite_rule is OK)){
return createBeautifullLink();
}else{
return createUglyLink();
}
Thanks in advance
use this:
in .htaccess
in PHP:
The first (apache) can be disabled by server, the second custom one will exist in $_SERVER only if mod_env is installed.
So what i think as best solution is to create a fake url redirection in your .htaccess that points to some file of yours (that return simply an “ok”) and call that with the redirection from a .php; if returns “ok”, you can use clean urls…
The redirection code in .htaccess might looks like: