WebGUI – Getting rid of index.pl

The RewriteRule that is explained in Ruling WebGUI does not work properly with newer versions of Apache. Perhaps there was another configuration somewhere that was causing the incompatibility, but I’ve successfully created a rule that strips out index.pl from all requests and forwards the request on for processing. For example, http://foo.com/index.pl/bar becomes http://foo.com/bar.

Add the following entry to the .htaccess file in the WebGUI html root:

RewriteEngine: On

# Don't rewrite index.pl (prevents infinite loops).
RewriteRule ^index\.pl - [L]

# Don't rewrite these directories or files.
RewriteRule ^(extras|uploads) - [L]

# Rewrite everything else.
RewriteRule ^(.+) index.pl/$1 [L]

Next, modify WebGUI.conf and add the following line:

scripturl = /

Everything is now all set! Please note that, if your browser hangs and Apache CPU usage spikes to 100% after making this change, there is an infinite loop going on and the server will need to be hit with a reload or a restart in order to recover. Fine for personal servers, inconvenient for Web hosted solutions.