Redirect goes to first website

Discussion in 'Installation/Configuration' started by dlucy, Jul 24, 2011.

  1. dlucy

    dlucy New Member

    I have several websites on a new install of ISPConfig 3 on Perfect Server for CentOS 5.6 64-bit. Works brilliantly.

    Except when I try to add a redirect.

    I already have site1.com created and working great. It's a Joomla site, using SuPHP + suEXEC.

    I add site2.com, go to the Redirect tab, specify "site1.com" and "R,L".

    Both domains have DNS A records at another server pointing to this Perfect Server CentOS server.

    After saving and waiting for the job to complete, I try to go to site2.com and find myself redirected to site3.com. That is the first site I created on this server.

    What can I do to fix this?
     
  2. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Can you post the Apache vhost configuration of site2.com?
     
  3. dlucy

    dlucy New Member

    Site2:

    Code:
    <Directory /var/www/site2.com>
        AllowOverride None
        Order Deny,Allow
        Deny from all
    </Directory>
    
    <VirtualHost 209.160.71.33:80>
        DocumentRoot /var/www/clients/client3/web2/web
    
        ServerName site2.com
        ServerAlias www.site2.com
        ServerAdmin webmaster@site2.com
    
        ErrorLog /var/log/ispconfig/httpd/site2.com/error.log
    
    
        ErrorDocument 400 /error/400.html
        ErrorDocument 401 /error/401.html
        ErrorDocument 403 /error/403.html
        ErrorDocument 404 /error/404.html
        ErrorDocument 405 /error/405.html
        ErrorDocument 500 /error/500.html
        ErrorDocument 503 /error/503.html
    
        <Directory /var/www/site2.com/web>
            Options FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
        <Directory /var/www/clients/client3/web2/web>
            Options FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
    
    
        # suexec enabled
        SuexecUserGroup web2 client3
        # Clear PHP settings of this website
        <FilesMatch "\.ph(p3?|tml)$">
            SetHandler None
        </FilesMatch>
        # suphp enabled
        <Directory /var/www/clients/client3/web2/web>
                    <IfModule mod_suphp.c>
            suPHP_Engine on
            # suPHP_UserGroup web2 client3
            AddHandler x-httpd-suphp .php .php3 .php4 .php5
            suPHP_AddHandler x-httpd-suphp
                    </IfModule>
        </Directory>
    
        # add support for apache mpm_itk
        <IfModule mpm_itk_module>
          AssignUserId web2 client3
        </IfModule>
    
        <IfModule mod_dav_fs.c>
          # DO NOT REMOVE THE COMMENTS!
          # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
          # WEBDAV BEGIN
          # WEBDAV END
        </IfModule>
    
    
    </VirtualHost>
    site1:
    Code:
    
    <Directory /var/www/site1.net>
        AllowOverride None
        Order Deny,Allow
        Deny from all
    </Directory>
    
    <VirtualHost 209.160.71.33:80>
          DocumentRoot /var/www/site1.net/web
      
        ServerName site1.net
        ServerAlias www.site1.net
        ServerAdmin webmaster@site1.net
    
        ErrorLog /var/log/ispconfig/httpd/site1.net/error.log
    
    
        ErrorDocument 400 /error/400.html
        ErrorDocument 401 /error/401.html
        ErrorDocument 403 /error/403.html
        ErrorDocument 404 /error/404.html
        ErrorDocument 405 /error/405.html
        ErrorDocument 500 /error/500.html
        ErrorDocument 503 /error/503.html
    
        <Directory /var/www/site1.net/web>
            Options FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
            <Files ~ '.php[s3-6]{0,1}$'>
                Order allow,deny
                Deny from all
                Allow from none
            </Files>
        </Directory>
        <Directory /var/www/clients/client3/web36/web>
            Options FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
            <Files ~ '.php[s3-6]{0,1}$'>
                Order allow,deny
                Deny from all
                Allow from none
            </Files>
        </Directory>
    
    
        # Clear PHP settings of this website
        <FilesMatch "\.ph(p3?|tml)$">
            SetHandler None
        </FilesMatch>
        
        RewriteEngine on
        RewriteCond %{HTTP_HOST}   ^site1.net [NC]
        RewriteRule   ^/(.*)$ http://site1.com/$1  [R,L]
        RewriteCond %{HTTP_HOST}   ^www.site1.net [NC]
        RewriteRule   ^/(.*)$ http://site1.com/$1  [R,L]
    
        # add support for apache mpm_itk
        <IfModule mpm_itk_module>
          AssignUserId web36 client3
        </IfModule>
    
        <IfModule mod_dav_fs.c>
          # DO NOT REMOVE THE COMMENTS!
          # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
          # WEBDAV BEGIN
          # WEBDAV END
        </IfModule>
    
    
    </VirtualHost>
     
  4. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    I don't see any rewrite rules in site2.com's vhost. Are you sure you saved the redirect in ISPConfig? Maybe you forgot to click on the "Save" button?
     
  5. dlucy

    dlucy New Member

    I definitely saved them. Reviewing that website now I can see the redirect settings in ISPConfig's screens. Perhaps the changes are not getting written to the vhost file?
     
  6. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Are there any errors in ISPConfig's Monitor module?
     
  7. dlucy

    dlucy New Member

    You mean on the main screen when you click "Monitor module"? No, there are no errors.
     
  8. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Did you check all the logs in the Monitor module?
     
  9. hueseo

    hueseo New Member

    how your that problem ? i also meet it but i can not fix, please share your experience. Thanks so much
     
: redirect 301

Share This Page