How to detect with PHP if Rewrite is enabled?

#1
Hello :)

When PHP is working as an Apache module, the apache_get_modules function is available and it lets you determine if mod_rewrite is loaded.

Is there a similar function for LiteSpeed Web Server?

How one should check if URL rewriting is enabled?

Reading a rewritable URL from own server with cURL seems too heavy.
 

webizen

Well-Known Member
#2
PHP doesn't yet have such a function for LSWS.

LSWS URL rewrite engine can enabled at virtual host and context level, and is inherited along the directory tree until it is explicitly overridden.

You can just create a unique rewrite rule that, if rewrite engine is enabled, would redirect to somewhere (an empty text file is suffice). Then test it with 'curl -I URL' (doesn't have to on the same box) and see if it returns 200 or 404 as the HTTP response.
 
Top