Website redirection

Discussion in 'General' started by SamTzu, Jan 5, 2012.

  1. SamTzu

    SamTzu Member HowtoForge Supporter

    Is there a way to redirect several different domains in ISPC3 to one site?

    This seems to work OK with Alias domains but aliases don't "redirect" so the website is displayed with wrong domain address.

    If Apache rules are also used with redirect options an infinite loop is usually the result.

    I would like to have this setup...

    domain1.com -> www.domain.fi
    www.domain.com -> www.domain.fi

    domain1.net -> www.domain.fi
    www.domain.net -> www.domain.fi

    domain2.com -> www.domain.fi
    www.domain.com -> www.domain.fi

    domain2.net -> www.domain.fi
    www.domain.net -> www.domain.fi

    etc.


    How should this setup be configured so that infinite loop does not result?
     
  2. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    That is done with aliases. Add each domain as alias and use "http://www.domain.fi" as redirect path.
     
  3. SamTzu

    SamTzu Member HowtoForge Supporter

    To clarify... instead of adding domain.fi in the alias name field I should add www.domain.fi?
     
  4. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    No, you have to add http:// in front of the redirect path.
     
  5. SamTzu

    SamTzu Member HowtoForge Supporter

    It does not seem to be possible to add www.domain.com in the Domain field on Alias settings.
     
  6. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    The redirect path field, not the domain field.

    Domain: domain1.net
    Parent website: domain.fi
    Redirect type: no flag
    Redirect path: http://www.domain.fi
     
  7. SamTzu

    SamTzu Member HowtoForge Supporter

    :)
    thx. You are the man.
     
  8. hotze.com

    hotze.com New Member

    redirect path to a FILE and not to a directory?

    Good day,

    I want to redirect to a file and not to a directory (ISPConfig Manual section 5.5 only writes about redirect to a path.

    so, I want to redirect www.foo.bar to http://www.otherfoo.bar/bla/blubb/lalelu.html

    it is not an option to let the "other" site at otherfoo.bar create an appropriate directory.

    How can this be solved? Within apache directly this is not a problem at all.

    thanks, martin
     
  9. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Create a .htaccess file and add your apache rewrite rules there instead of using the rewrite function in the domain settings.
     
  10. hotze.com

    hotze.com New Member

    yes, but then the enduser has to use a FTP client etc ... else one just has to edit the line within ISPConfig, this would be a much smarter, quicker and easier solution for everybody involved (even for support).
     
  11. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    The ispconfig redirect function is made to redirect a domain to a directory only. What you try to do is a typical redirect as it is used by cms systems in .htaccess files and should be added to a .htaccess file.
     
  12. hotze.com

    hotze.com New Member


    well, currently we do it manually in apache:

    <VirtualHost 192.168.3.4>
    ServerName www.foo.bar
    Redirect permanent / http://www.otherfoo.bar/bla/blubb/lalelu.html
    CustomLog /var/log/httpd/redirect-access.log combined
    ErrorLog /var/log/httpd/redirect-error.log
    </VirtualHost>

    ... and this is what I try to also solve directly in ISPConfig. The "only redirect to directories" is, AFAIK, not an Apache rule.
     
  13. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Of course, as you do this not in the intended way. Your way is for servers that dont have ispconfig installed.

    The correct way(s) for ISPConfig servers are e.g:

    1) Add www.foo.bar as website or as aliasdomain of another wesbite in ISPConfig.

    2a) Then either add a file named .htaccess in the web directory of the website containing just one line:

    Redirect permanent / http://www.otherfoo.bar/bla/blubb/lalelu.html

    2b) Or you add this line:

    Redirect permanent / http://www.otherfoo.bar/bla/blubb/lalelu.html

    in the apache directives field of the website in ISPConfig, which is on the options tab.
     
    Last edited: Jan 13, 2012
  14. hotze.com

    hotze.com New Member

    as for option 2b: thanks ... better than nothing :)
    means: at least doable as admin within ISPconfig.

    the customer (still) has no option to change the settings (only with option 2a).

    :D
     
  15. vaio

    vaio New Member

    Hello, i have a question.

    If i use L redirect under website settings, this means that it redirects to different site, but preserves web address?

    Example:
    www.WEB1.tld -> www.websiteone.tld, but showing WEB1.tld as url

    (i have tried that, but shows websiteone.tld as url).

    Should i use different settings?
    Thank you for advice!

    V.
     
  16. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

  17. vaio

    vaio New Member

    Thank you Till for pointing that out.

    I believe there is a small bug in 3.0.4.3:
    1. i have created website and added redirection to other - works OK
    2. i have than removed this redirection - shows like no redirection, but it still redirects... - i think it didn't remove redirection as it should, still redirects to other site /on monitor system log was completed

    I will completely remove site, than add it again and hopefully it will solve this problems. I just need to make backups etc first.

    Will report back!
    V.
     
  18. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    There is no such bug and there is no need to remove the site. Just close your browser or empty the browser cache as the browser remembers the redirect. Beside that, ensure that you waited until the jobqueue in the monitor is empty as it takes some time until the changes are written to disk.
     
: apache, redirect

Share This Page