strange redirect problems

Djunity

Verified User
Joined
Mar 9, 2008
Messages
243
Location
Holland
Hi all,

A customer of us reported the following problem to us.

for example if we want to redirect testing.123hostingservice.nl to a sub map for example testing.123hostingservice.nl/test/ we added this rule true da panel so htaccess gets created and is ok.

Now if you enter testing.123hostingservice.nl you get redirected to

And resulting in an error aka (runned this true google translate)
The page is not an appropriate way by

Firefox has determined that the server redirects the request for this address in a way that will never end.

This problem can sometimes be caused by disabling or refusing
cookies.
 
Something is wrong with your rule then.

What do you have for htaccess redirect?

You just need something like this in .htaccess

Code:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^testing\.123hostingservice\.nl [NC]
RewriteCond %{REQUEST_URI} !^/test/
RewriteRule (.*) http://testing.123hostingservice.nl/test/$1 [R=301,L]
</IfModule>
 
that also doesnt work so im guessing something is wrong with apache.

The site redirect option in da panel we use on multiple servers but now on one of the servers it doesnt work anymore.
 
What do you mean by

that also doesnt work

you've got loops here with mod_rewrite? If so put in test/ directory then this .htaccess file:


Code:
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
 
What do you mean by



you've got loops here with mod_rewrite? If so put in test/ directory then this .htaccess file:


Code:
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>


Code:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^testing\.123hostingservice\.nl [NC]
RewriteCond %{REQUEST_URI} !^/test/
RewriteRule (.*) http://testing.123hostingservice.nl/test/$1 [R=301,L]
</IfModule>
doesnt work either

and
Code:
[code]<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
[/code]
also doesnt change anything the loop is still there
 
For simple redirect cases, I like to use a php Location redirect, instead of .htaccess files (which can get confusing).

In public_html/testing/index.php, add the code:
PHP:
<?php header("Location: http://testing.123hostingservice.nl/test"); ?>

Related:
http://help.directadmin.com/item.php?id=37

------

As for the .htaccess, putting it into the public_html/testing/.htaccess, instead of public_html/.htaccess may help resolve the issues, as the public_html/.htaccess propagates down into public_html/test/ as well.

John
 
Related:
http://help.directadmin.com/item.php?id=37

------

As for the .htaccess, putting it into the public_html/testing/.htaccess, instead of public_html/.htaccess may help resolve the issues, as the public_html/.htaccess propagates down into public_html/test/ as well.

John

The php redirect command i know and use my self, the problem is that or customers are complaining that the site redirect function from da panel that creates the .htaccess doesnt work any more so im wondering what could be wrong here becouse it used to work and on other servers it still works aka http://www.123hostingservice.nl/domein/ redirect works this is on another server
 
Yes off course sorry if you misunderstood my message thats why i posted in apache section, is it possible that mod_rewrite not working correct or newer apache or mod_rewrite versions aint supporting htaccess redirect rules any more ?
 
Note, I did not check user scsi's rules for mod_rewrite. So I can't say anything of them, but you might need to play with them (or even debug) and change a little bit. And as far as I know the recent versions of Apache have nothing changed in support for redirect rules and mod_rewrite.
 
Yes off course sorry if you misunderstood my message thats why i posted in apache section, is it possible that mod_rewrite not working correct or newer apache or mod_rewrite versions aint supporting htaccess redirect rules any more ?

I believe it is working properly, and find it hard to believe that you did not have the same problem before. It happens because the subdomain you create is created in the path public_html/subdomainfolder and because you are creating .htaccess redirect from the same domain as the subdomain is on. .htaccess works in that way that the .htaccess rules propagate to all directories beneath the directory that you create your .htaccess

So you could solve the problem by creating the subdomain as a fully hosted domain, instead of creating it in the normal way. Just create the subdomain in same way as you create top level domains, and then the subdomain will not be placed in public_html in the domain you are redirecting from, but instead the subdomain is created directly in /domains folder. Then your problem should not happen.

It is not a bug, it is the way .htaccess work. You should not see this problem if you create .htaccess redirect from other domains, only when you do it for the same domain as the subdomain is inside.
 
I believe it is working properly, and find it hard to believe that you did not have the same problem before. It happens because the subdomain you create is created in the path public_html/subdomainfolder and because you are creating .htaccess redirect from the same domain as the subdomain is on. .htaccess works in that way that the .htaccess rules propagate to all directories beneath the directory that you create your .htaccess

So you could solve the problem by creating the subdomain as a fully hosted domain, instead of creating it in the normal way. Just create the subdomain in same way as you create top level domains, and then the subdomain will not be placed in public_html in the domain you are redirecting from, but instead the subdomain is created directly in /domains folder. Then your problem should not happen.

It is not a bug, it is the way .htaccess work. You should not see this problem if you create .htaccess redirect from other domains, only when you do it for the same domain as the subdomain is inside.

This domain is for test that i created on one of the servers that has problems or customer that complains has a fully hosted domain and the domain i posted here is also a fully hosted domain so that can not be the problem.
 
Ok, I misunderstood. However the problem is the same as I described.

You want to redirect testing.123hostingservice.nl to testing.123hostingservice.nl/test/ using DirectAdmin to create .htaccess, but that will not work because the directory "test" is in the public_html folder of the domain that you are redirecting. The problem is the same as I described, even it is not a subdomain but only a folder. If you do the same thing, but redirect to "test" folder on another domain, then it will work.
 
Back
Top