Aliasdomain to 301 redirect to the root of new domain

Discussion in 'General' started by miguelpinheiro, Jun 6, 2016.

  1. Hello everyone.

    I'm struggling to redirect an old domain website to a new domain using aliasdomain in IspConfig 3.0 (latest release), Apache 2.4 and Debian.

    I want to redirect all the pages in an to the root of

    So far I got it working from to However, the path on the new domain is different. That's why I want to redirect always to the root of the newdomain.

    My current settings are those:

    Parent Website: :: server
    Redirect Type: R=301,L
    Redirect Path: <empty>
    Auto-Subdomain: www.
    SEO Redirect: domain.tld => www.domain.tld

    Can anyone help me figure out how can I achieve this?

    Thanks. Regards.

  2. till

    till Super Moderator Staff Member ISPConfig Developer

  3. Thanks for the help Till.
    I tried the redirect path but is not working. It keeps redirecting to http://www.newdomain.tld/path...
    In the vhost file it is generated the following:

    ServerName newdomain.tld
    ServerAlias newdomain.tld
    ServerAlias www.olddomain.tld olddomain.tld
    ServerAdmin [email protected]
    RewriteEngine on
            RewriteCond %{HTTP_HOST} ^olddomain\.tld$ [NC]
            RewriteRule ^(.*)$ http://www.olddomain.tld$1 [R=301,L]
            RewriteCond %{HTTP_HOST}  ^newdomain\.tld$ [NC]      
            RewriteRule   ^/(.*)$ http://www.newdomain.tld/$1  [R=301,L]
            RewriteCond %{HTTP_HOST}   ^olddomain\.tld$ [NC]
            RewriteRule   ^/(.*)$ http://www.newdomain.tld/$1  [R=301,L]
            RewriteCond %{HTTP_HOST}   ^www\.olddomain\.tld$ [NC]
            RewriteRule   ^/(.*)$ http://www.newdomain.tld/$1  [R=301,L]
    I guess the first RewriteCond and RewriteRule should be with $1. Does this make any sense?

Share This Page