PDA

View Full Version : problem with redirect on secondary domain



dbrugge
08-26-2009, 11:39 PM
I have this configuration setting in my httpd.conf



<VirtualHost *:80>
ServerName 2nd-domain1.com
ServerAlias www.2nd-domain1.com
DocumentRoot /www/2nd-domain1
<Directory "/www/2nd-domain1">
Options FollowSymLinks MultiViews Includes ExecCGI
AddHandler cgi-script .cgi .pl .py .sh
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName 2nd-domain2.com
ServerAlias www.2nd-domain2.com
DocumentRoot /www/2nd-domain2
<Directory "/www/2nd-domain2">
Options FollowSymLinks MultiViews Includes ExecCGI
AddHandler cgi-script .cgi .pl .py .sh
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

I have this .htaccess in the folder at /usr/local/apache/2nd-domain1 and the equilivent at /usr/local/apache/2nd-domain2


Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^2nd-domain1.com
RewriteRule (.*) http://2nd-domain1.com/$1 [R=301,L]

I am looking to get my www.subdomain.com redirected to subdomain.com
This works fine at 2nd-domain2, but on 2nd-domain1 I get the error...
"Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

Here's the stumper. When I remove .htaccess compleately from 2nd-domain1 and enter a non-www url, I get redirected to a www url, removing .htaccess from the other secondary domains does not have the same effect.

I assume that I have something else set somewhere else, that I am overlooking. Where else would I look for a redirect?

Any suggestions?

wildjokerdesign
08-27-2009, 07:36 AM
Did you set up your secondary domains via Site Manager?

/www is a symbolic link to /usr/local/apache. Inside /usr/local/apache you have a symbolic link for your main domain that should lead to /var/www/html. Are your secondary domains also a symbolic link of this type? My thought is that the symbolic links may be causing you an issue. If you'll notice your main domains Document Root is a full path to /var/www/html.

Your .htaccess is correct (at least it is one of the correct ways (http://www.webmasterworld.com/apache/3223535.htm)). You have added the correct things to your httpd.conf file to enable the use of .htaccess.

dbrugge
08-27-2009, 09:23 PM
Yes I did use Site Manager to set up my secondary domains. The first one I set up many years ago and I didn't pay attention to where on the hierarchy the files were set. By default, it made a subdirectory at /usr/local/apache/ and I have added the others there as well.
As far as having a symbolic link to /usr/local/apache/, when I click on the www subdirectory, it opens /usr/local/apache/. Do I need any additional link to each subdomain?

As far as the .htaccess, I have used the example above and

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.subdomain.com
RewriteRule (.*) http://subdomain.com/$1 [R=301,L]

I have a e-commerce site on my main domain that uses an SSL. If memory serves me correct, I started using the first version so that it wouldn't interfere with my https requests.

My wife says that I am talented in many areas, but networking, web servers and DNS is certainly not on that list.

BTW, I did solve one mystery. I missed the notice that my ISP (Comcast) had started using their "Domain Helper" program. They have taken it upon themselves to automatically redirect me a different URL's if the one that I type generates an error.
(I've since then opted out of their "Domain Helper" program. 'kinda makes it tough to debug websites)

wildjokerdesign
08-28-2009, 06:36 AM
You could try changing both paths to their absolutes of /usr/local/apache/2nd-domain1 and /usr/local/apache/2nd-domain2 but I have a sneaking suspicion that I am missing something. :)

Look for other .htaccess files that may be affecting this. What type of sites are these? Are the php programs that may be using search engine friendly URLs and have a .htaccess file in a higher directory. "I have a e-commerce site on my main domain that uses an SSL. If memory serves me correct, I started using the first version so that it wouldn't interfere with my https requests." Where is the .htaccess file for it if any?

Double check that the .htaccess files you are using are correct. A small typo can through everything off. :)

Have someone check the sites for you once you have the files uploaded. This will make sure it is not something on your end like the "service" your provider is offering. You could PM me the links if you don't want to post them publicly and I could check them.