"Redirection Loop"

iUnknown

Active Member
#1
Redirect Loop

Redirection limit for this URL exceeded. Unable to load the requested page. This may be caused by cookies that are blocked.
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:

Code:
RewriteEngine on

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
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!
 

auser

Super Moderator
#2
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^.*$ "http\:\/\/domain\.com\/cubecart\/index\.php" [R=301,L]

[/CODE]
This will cause infinite redirect:
Code:
http://domain.com-->http://domain.com/domain.com-->http://domain.com/domain.com/domain.com/...
try: change last RewriteRule to
Code:
RewriteRule ^.*$  /cubecart/index.php [L]
 

iUnknown

Active Member
#3
Hi,

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.
 

auser

Super Moderator
#4
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:

Code:
<html>
<head>
<meta HTTP-EQUIV="REFRESH" content="0; url=cubecart/index.php">
</head>
</html>
 

iUnknown

Active Member
#5
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:

Code:
<html>
<head>
<meta HTTP-EQUIV="REFRESH" content="0; url=cubecart/index.php">
</head>
</html>
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?

Thanks.
 

auser

Super Moderator
#8
just looked up apache document:
http://httpd.apache.org/docs/trunk/rewrite/rewrite_intro.html

"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
Code:
RewriteRule ^$  http://domain.com/cubecart/index.php [L]
tested on my box, it's working in .htaccess
 

iUnknown

Active Member
#9
Hi,

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.
 
Top