This is an old revision of the document!


Why my redirect from /cgi-bin/script working with apache but 404 on LSWS?

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

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

When 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/

It will work with apache, but LSWS will return 404 error. “ScriptAlias /cgi-bin/” setting makes apache working, but LSWS cannot find any existing /cg-bin/ folder under /public_html/ hence it returns 404 error.

How to fix it?

You should create 'cgi-bin' folder and create .htaccess file at /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.

  • Admin
  • Last modified: 2018/06/14 14:53
  • by Jackson Zhang