Detecting mod_rewrite using PHP
The following post is about a solution to the problem of detecting if mod_rewrite is enabled or not. I worked on a project where CS-CART was used and after it was installed, it was complaining that the mod_rewrite module was not installed. I knew that mod_rewrite was installed so I looked at the code. The code that was detecting if mod_rewrite was enabled was assuming the DNS for the domain was working fine. It was doing an HTTP request. This means that if we installed the store in a temporary environment where the hostname is fake (put in the HOSTS file for example) then it would think mod_rewrite is NOT installed or enabled.
I think I came up with a better way and here it is. I submitted it to the CS-CART staff, we'll see if they like it.