#1 (permalink)  
Old 05-22-2009, 04:49 AM
Registered User
 
Join Date: May 2009
Posts: 2
ahmadsuzairi is on a distinguished road
Exclamation Redirect Loop

Hello everybody..

i have the problem n have read through the forum about this kind of problem but not really understand about this matters. hopefully somebody can help me.

mydomainDOTnet
redirect to:
mydomainDOTnet/v3

then, redirect loop message appear.

anybody that i can trust here to help me solve this problem? tq very much.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-22-2009, 08:33 AM
Registered User
 
Join Date: Apr 2009
Posts: 155
InstaCarma_Tech is on a distinguished road
How have you set up this re-direction?

If you are still facing the issue then remove the current redirection and try using the following code in your .htaccess file under the public_html folder

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^mydomain.net/$ [NC,OR]
RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^www.mydomain.net/$ [NC]
RewriteRule ^(.*)$ http://www.mydomain.net/v3/$1 [r=301,nc]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-22-2009, 10:23 AM
Registered User
 
Join Date: May 2009
Posts: 2
ahmadsuzairi is on a distinguished road
Thanks a lot, InstaCarma_Tech.

it`s very useful n i did it.

really appreciate. thanks again.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-22-2009, 02:12 PM
Registered User
 
Join Date: May 2008
Posts: 905
thewebhosting is on a distinguished road
Quote:
Originally Posted by ahmadsuzairi View Post
Thanks a lot, InstaCarma_Tech.

it`s very useful n i did it.

really appreciate. thanks again.
Happy to know that your issue has been resolved. But, can you tell us what exactly you were doing wrong previously?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-28-2009, 04:08 PM
Registered User
 
Join Date: May 2006
Posts: 37
FearlessG1 is on a distinguished road
I used the method insta mentioned above and the redirects work, but using the cpanel redirect I get the same error as the OP. when I look at my hta file that using cpanel creates, i get this:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^mydomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.com$
RewriteRule ^.*$ "http\:\/\/mydomain\.com\/forums" [R=301,L]



and with that i get the redirect loop error. using the method Insta provided it redirects correctly, and when I look at the redirect link in cpanel, it shows it there but only temporary. Any idea why cpanel is creating such a different looking hta file?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 05-29-2009, 02:55 PM
Registered User
 
Join Date: May 2006
Posts: 37
FearlessG1 is on a distinguished road
doing a forum search, this seems to be a pretty common problem lately. Cpanel?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 06-15-2009, 02:05 PM
Registered User
 
Join Date: Nov 2008
Posts: 13
mattdmin is on a distinguished road
Redirect loop

I'm having the same problem. If you go through cpanel to do ANY redirects it doesn't work. Editing the .htaccess file is not a decent fix for this, only a temp fix, specially since my clients don't even have an idea what a .htaccess file is. Anyone come up with something to fix this other than the .htaccess edit for each redirect?

<ADDED>
There's actually a problem with the way cpanel is writing the .htaccess file, it's adding unessasary or wrong characters (\) into the file. So for example....

Cpanel writes the file like so:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.com$
RewriteRule ^.*$ "http\:\/\/www\.mydomain\.com\/random_directory" [R=301,L]


Below is how it should look:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.com$
RewriteRule ^.?$ http://www.mydomain.com/random_directory [R=301,L]

Last edited by mattdmin; 06-15-2009 at 02:23 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 06-30-2009, 12:20 AM
j4t j4t is offline
Registered User
 
Join Date: Mar 2008
Posts: 2
j4t is on a distinguished road
I'm having the same problem. And I can't even find an .htaccess file anywhere! Any advice? Any ideas as to when CPanel will be correcting this problem?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 07-02-2009, 08:12 AM
Registered User
 
Join Date: Apr 2009
Posts: 155
InstaCarma_Tech is on a distinguished road
Quote:
Originally Posted by j4t View Post
I'm having the same problem. And I can't even find an .htaccess file anywhere! Any advice?
Normally, '.htaccess' should be present under your 'public_html' directory. If there isn't one then you can create one with the name as '.htaccess' and put the redirection rules in it.
__________________
InstaCarma
Outsourced Web Hosting Technical Support and Server Management

To visit out Blog , click here
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 07-03-2009, 02:01 AM
Spiral's Avatar
Registered User
 
Join Date: Jun 2005
Location: Area 51
Posts: 1,501
Spiral is on a distinguished road
Exclamation

Quote:
Originally Posted by mattdmin View Post
...There's actually a problem with the way cpanel is writing the .htaccess file, it's adding unessasary or wrong characters (\) into the file. So for example....

Cpanel writes the file like so:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.com$
RewriteRule ^.*$ "http\:\/\/www\.mydomain\.com\/random_directory" [R=301,L]


Below is how it should look:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.com$
RewriteRule ^.?$ http://www.mydomain.com/random_directory [R=301,L]
On the contrary, both of of those blocks will work just fine although
the first block of code you wrote above is technically more accurate as
it is using properly quoted strings and standard escaped characters
although the second block of commands you wrote without the escaped
characters or quoting will generally work just as well as most servers will
often just assume escapes and quotes where needed.

It sounds like from your post you may have possibly heard about or seen
the recent security memo on the escaped .htaccess comment hack and
may have erroneously been thinking they were talking about what you
just mentioned about but the probably was actually something different.

Basically, some recent exploit scripts for shared hosting accounts were
changing the comment (#) character in .htaccess files on servers that
did not have SuPHP/SuExect to instead read (\#) for the htaccess
comments and this change, unlike what you wrote above, actually
causes .htaccess to fail with sites generating an error 500 condition.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11 (permalink)  
Old 07-09-2009, 06:02 AM
Registered User
 
Join Date: Jan 2006
Posts: 579
4u123 is on a distinguished road
Thumbs down

Quote:
Originally Posted by Spiral View Post
On the contrary, both of of those blocks will work just fine although
the first block of code you wrote above is technically more accurate as
it is using properly quoted strings and standard escaped characters
although the second block of commands you wrote without the escaped
characters or quoting will generally work just as well as most servers will
often just assume escapes and quotes where needed.
I'm afraid you are incorrect.

The addittion of the slashes to escape the characters in the rewrite rule causes this problem. While to you this might look correct in theory, in practice is just doesnt work on many cpanel servers. We have this exact problem on many of our servers using apache 2.2 and all we can do is remove the slashes when a customer complains the redirect didnt work.

I accept that this may be an issue with mod_rewrite on apache 2.2 but you are basically saying "there isnt a problem" when in reality there is.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 07-09-2009, 08:28 AM
Registered User
 
Join Date: May 2006
Posts: 37
FearlessG1 is on a distinguished road
I have to agree with 4u123, allowing cpanel to create the hta data generates the code with slashes, and my redirects do not work. removing the slashes and using the format provided earlier and my redirects work fine, so there is most definitely a problem with the default handling of this, at least on my server.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 07-09-2009, 12:56 PM
cPanelDavidG's Avatar
cPanel Technical Sales
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 7,995
cPanelDavidG is on a distinguished road
The redirect loop issue mentioned in this thread will be resolved in builds 37095 and later.
__________________
Want our technical analysts to login to your server to assist you? You can contact our technical analysts at: http://tickets.cPanel.net/submit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 07-09-2009, 05:08 PM
Spiral's Avatar
Registered User
 
Join Date: Jun 2005
Location: Area 51
Posts: 1,501
Spiral is on a distinguished road
Lightbulb

Quote:
Originally Posted by 4u123 View Post
I'm afraid you are incorrect.

The addittion of the slashes to escape the characters in the rewrite rule causes this problem. While to you this might look correct in theory, in practice is just doesnt work on many cpanel servers. We have this exact problem on many of our servers using apache 2.2 and all we can do is remove the slashes when a customer complains the redirect didnt work.

I accept that this may be an issue with mod_rewrite on apache 2.2 but you are basically saying "there isnt a problem" when in reality there is.
No I am not saying there "is not problem". I am however saying it's not
the backslashes causing your issue as that is a normal standard and just
to be certain nothing changed in 2.2 as you said, I just took 3 servers
on Apache 2.0.63 and 3 other servers on Apache 2.2.11 and ran some
mod_rewrite tests with both escaped and unescaped (backslash) characters
and I could not duplicate any problems from that. The redirects worked
the same with and without the backslashes and I also tested this from
3 different browsers including Firefox, IE, and Chrome as well.

If you server doesn't like escaped characters in mod_rewrite redirects,
there is something different about your server beyond just have Apache 2.2.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 07-14-2009, 07:58 AM
Registered User
 
Join Date: Jan 2006
Posts: 579
4u123 is on a distinguished road
Quote:
Originally Posted by Spiral View Post
No I am not saying there "is not problem". I am however saying it's not
the backslashes causing your issue as that is a normal standard and just
to be certain nothing changed in 2.2 as you said, I just took 3 servers
on Apache 2.0.63 and 3 other servers on Apache 2.2.11 and ran some
mod_rewrite tests with both escaped and unescaped (backslash) characters
and I could not duplicate any problems from that. The redirects worked
the same with and without the backslashes and I also tested this from
3 different browsers including Firefox, IE, and Chrome as well.

If you server doesn't like escaped characters in mod_rewrite redirects,
there is something different about your server beyond just have Apache 2.2.
Well in that case I'd love to find out what the difference is. I have 30 servers all compiled by EA3 with Apache 2.2 very recently on cpanel release build. They are all identical. I havent had time to test all of them but so far at least four of them are having this problem.

I notice that to make this work we have to replace the asterisk with a question mark - whats the significance of that?

Last edited by 4u123; 07-14-2009 at 09:46 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 04:35 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© cPanel Inc