Differences
This shows you the differences between two versions of the page.
litespeed_wiki:config:redirect_cgi-bin_no_exist_404 [2018/06/14 14:53] Jackson Zhang created |
litespeed_wiki:config:redirect_cgi-bin_no_exist_404 [2018/06/14 16:21] Lisa Clarke Proofreading |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Why my redirect from /cgi-bin/script working with apache but 404 on LSWS? ====== | + | ====== cgi-bin Script Redirect Not Found on LiteSpeed Web Server ====== |
- | 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: | + | 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> | <IfModule alias_module> | ||
ScriptAlias /cgi-bin/ /home/USER1/public_html/cgi-bin/ | ScriptAlias /cgi-bin/ /home/USER1/public_html/cgi-bin/ | ||
</IfModule> | </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? | + | ''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. |
- | You should create 'cgi-bin' folder and create .htaccess file at /cgi-bin/.htaccess, then move the exact redirect rule there. | + | 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/ | Redirect 301 /cgi-bin/n/v.cgi?c=1&id=930019428 /planet/ | ||
LSWS should work fine and won't return 404 anymore. | LSWS should work fine and won't return 404 anymore. |