How to detect with PHP if Rewrite is enabled?

Discussion in 'PHP' started by vassilevsky, Oct 26, 2010.

  1. vassilevsky

    vassilevsky New Member

    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.
  2. webizen

    webizen Well-Known Member

    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.

Share This Page