The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Redirect Loop

Discussion in 'General Discussion' started by ahmadsuzairi, May 22, 2009.

  1. ahmadsuzairi

    ahmadsuzairi Registered

    Joined:
    May 22, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
  2. InstaCarma_Tech

    InstaCarma_Tech Well-Known Member

    Joined:
    Apr 22, 2009
    Messages:
    228
    Likes Received:
    1
    Trophy Points:
    18
    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]
     
    Eric likes this.
  3. ahmadsuzairi

    ahmadsuzairi Registered

    Joined:
    May 22, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Thanks a lot, InstaCarma_Tech.

    it`s very useful n i did it. :)

    really appreciate. thanks again.
     
  4. thewebhosting

    thewebhosting Well-Known Member

    Joined:
    May 9, 2008
    Messages:
    1,201
    Likes Received:
    1
    Trophy Points:
    38
    Happy to know that your issue has been resolved. But, can you tell us what exactly you were doing wrong previously?
     
  5. FearlessG1

    FearlessG1 Active Member

    Joined:
    May 5, 2006
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    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?
     
  6. FearlessG1

    FearlessG1 Active Member

    Joined:
    May 5, 2006
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    doing a forum search, this seems to be a pretty common problem lately. Cpanel?
     
  7. mattdmin

    mattdmin Member

    Joined:
    Nov 28, 2008
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    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]
     
    #7 mattdmin, Jun 15, 2009
    Last edited: Jun 15, 2009
  8. j4t

    j4t Registered

    Joined:
    Mar 7, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    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?
     
  9. InstaCarma_Tech

    InstaCarma_Tech Well-Known Member

    Joined:
    Apr 22, 2009
    Messages:
    228
    Likes Received:
    1
    Trophy Points:
    18
    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.
     
  10. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    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.
     
  11. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    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.
     
  12. FearlessG1

    FearlessG1 Active Member

    Joined:
    May 5, 2006
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    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.
     
  13. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    The redirect loop issue mentioned in this thread will be resolved in builds 37095 and later.
     
  14. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    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.
     
  15. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    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?
     
    #15 4u123, Jul 14, 2009
    Last edited: Jul 14, 2009
  16. cesarlwh

    cesarlwh Well-Known Member

    Joined:
    Sep 23, 2008
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    Not! In this version the problem continue:

    cPanel 11.24.5-R37127 - WHM 11.24.2 - X 3.9
     
  17. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Oh did CpanelDavidG say 37095? He meant 39705! :D

    (It's easy to confuse ;) )
     
    #17 Spiral, Jul 19, 2009
    Last edited: Jul 19, 2009
  18. rs-freddo

    rs-freddo Well-Known Member

    Joined:
    May 13, 2003
    Messages:
    832
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
  19. rs-freddo

    rs-freddo Well-Known Member

    Joined:
    May 13, 2003
    Messages:
    832
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
    Re: Email retention policy

    Can we finally get this issued fixed Nick : http://forums.cpanel.net/f34/redirect-loop-118985.html
    It's been broken since 2009, would love it to be fixed in 11.34
    Should be easy, cpanel users have already documented in the thread what is wrong and what needs to be fixed.
     
  20. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider
    Hi Michael,

    We were unable to replicate in either 11.32 or 11.34. We put a couple of people at it, and were not able to make it happen. If you could open a ticket with an affected server with the subject 'ATTN: Cory QA', we would be happy to look at the problem.

    Thanks
     
Loading...

Share This Page