"Redirection Loop"

Discussion in 'General' started by iUnknown, Apr 25, 2009.

  1. iUnknown

    iUnknown Active Member

    This is the error that I get when I try to load a perfectly normal website which has created a redirect in their cPanel to redirect to a directory on their website.

    In the .htaccess:

    RewriteEngine on
    # -FrontPage-
    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    AuthName domain.com
    AuthUserFile /home/username/public_html/_vti_pvt/service.pwd
    AuthGroupFile /home/username/public_html/_vti_pvt/service.grp
    RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.domain.com$
    RewriteRule ^.*$ "http\:\/\/domain\.com\/cubecart\/index\.php" [R=301,L]
    I have contacted cPanel and they say that this is a litespeed error rather than anything they can support/fix. Is this "RewriteRule" buggy in litespeed... and what can I do to fix this and get the redirect working?

    Thank you very much!
  2. auser

    auser Super Moderator

    This will cause infinite redirect:
    try: change last RewriteRule to
    RewriteRule ^.*$  /cubecart/index.php [L]
  3. iUnknown

    iUnknown Active Member


    Thanks for the response! That kind of works but it shows the content of /cubecart whilst staying on the main domain which breaks some of the images etc.

    How can I make it fully redirect the URL to /cubecart?

    Thanks again.
  4. auser

    auser Super Moderator

    can't get out a good Rewrite Rule at the moment :)

    there is one workaround may work in your case.
    create a index.html in your document root:

    <meta HTTP-EQUIV="REFRESH" content="0; url=cubecart/index.php">
  5. iUnknown

    iUnknown Active Member

    I know that is an option but I am looking for a way to do it by .htaccess which should work fine in Litespeed... are you saying I cannot do this?

  6. auser

    auser Super Moderator

    how about this one? just one line:
    RewriteRule ^/$  http://domain.com/cubecart/index.php [L]
  7. iUnknown

    iUnknown Active Member

    That just doesn't redirect :p

    (Edit: and yes I have changed domain.com appropriately)
  8. auser

    auser Super Moderator

    just looked up apache document:

    "The main difference with per-server rewrites is that the path prefix of the directory containing the .htaccess file is stripped before matching in the RewriteRule"

    so there's difference for per-server and per-directory rewrite rule.
    (just know it :) )

    the one line RewriteRule in my last post works for per-server rewrite.
    the per-directory version is
    RewriteRule ^$  http://domain.com/cubecart/index.php [L]
    tested on my box, it's working in .htaccess
  9. iUnknown

    iUnknown Active Member


    Thanks very much. It doesn't seem to work but just before you posted that I've decided to just use one of your previous ideas of the HTML redirect and that does the job fine so I'll leave it like that.

    If this problem arises again with a different account, I'll try your new method!

    Thanks very much.

Share This Page