|
|||
|
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. |
|
|||
|
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]
|
|
|||
|
Happy to know that your issue has been resolved. But, can you tell us what exactly you were doing wrong previously?
|
|
|||
|
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? |
|
|||
|
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. |
|
|||
|
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 |
|
||||
|
Quote:
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.
__________________
My Server Expert: Server support, security, and management! |
|
|||
|
Quote:
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. |
|
|||
|
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.
|
|
||||
|
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 |
|
||||
|
Quote:
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.
__________________
My Server Expert: Server support, security, and management! |
|
|||
|
Quote:
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. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|