cgi-bin Script Redirect Not Found on LiteSpeed Web Server

Why would a redirect from /cgi-bin/script work fine with Apache, but result in a 404 error on LSWS?

Assume you have some redirect rules in /home/USER1/public_html/.htaccess. For example:

Redirect 301 /cgi-bin/n/v.cgi?c=1&id=930019428 /planet/

This will work with Apache, but LSWS will return a 404 error. Why?

In a cPanel environment, under /home/USER1/public_html, there is no cgi-bin folder normally. However, in a cPanel Apache virtual host setting, you will find a ScriptAlias setting like this:

<IfModule alias_module>
ScriptAlias /cgi-bin/ /home/USER1/public_html/cgi-bin/

ScriptAlias /cgi-bin/ makes Apache work, but but LSWS cannot find any existing /cgi-bin/ folder under /public_html/. Hence it returns a 404 error.

To fix the problem, create a cgi-bin folder, and create /cgi-bin/.htaccess. Then, move the exact redirect rule there:

  Redirect 301 /cgi-bin/n/v.cgi?c=1&id=930019428 /planet/

LSWS should work fine and won't return 404 anymore.

litespeed_wiki/config/redirect_cgi-bin_no_exist_404.txt · Last modified: 2018/06/14 16:21 by Lisa Clarke