Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 17
  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    2

    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.

  2. #2
    Member
    Join Date
    Apr 2009
    Posts
    230

    Default

    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]

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    2

    Default

    Thanks a lot, InstaCarma_Tech.

    it`s very useful n i did it.

    really appreciate. thanks again.

  4. #4
    Member
    Join Date
    May 2008
    Posts
    1,114

    Default

    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?

  5. #5
    Member
    Join Date
    May 2006
    Posts
    37

    Default

    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. #6
    Member
    Join Date
    May 2006
    Posts
    37

    Default

    doing a forum search, this seems to be a pretty common problem lately. Cpanel?

  7. #7
    Member
    Join Date
    Nov 2008
    Posts
    13

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

  8. #8
    j4t
    j4t is offline
    Registered User
    Join Date
    Mar 2008
    Posts
    2

    Default

    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. #9
    Member
    Join Date
    Apr 2009
    Posts
    230

    Default

    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.

  10. #10
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    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.

  11. #11
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jan 2006
    Posts
    640

    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.

  12. #12
    Member
    Join Date
    May 2006
    Posts
    37

    Default

    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. #13
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    10,718
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    The redirect loop issue mentioned in this thread will be resolved in builds 37095 and later.

  14. #14
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    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.

  15. #15
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jan 2006
    Posts
    640

    Default

    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.

Similar Threads & Tags
Similar threads

  1. cPanel redirect tool is errant - redirect loop error
    By jols in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 07-19-2009, 03:05 PM
  2. redirect loop issue
    By Uilmuteiz in forum New User Questions
    Replies: 5
    Last Post: 07-07-2009, 02:17 PM
  3. Redirect Loop
    By neumannu47 in forum New User Questions
    Replies: 2
    Last Post: 03-28-2009, 08:24 AM
  4. Redirect Loop
    By nineseven in forum Database Discussions
    Replies: 3
    Last Post: 11-26-2008, 08:46 AM
  5. Subdomain Redirect Loop
    By Water in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 08-27-2003, 01:08 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube