Redirect domain - .htaccess

  • Hi!


    I looked it on the forum, but I didn't find.


    I would like to make a simple domain redirect.


    domain.com -> domain.hu


    I tried use .htaccess generator but is not working.


    Example: http://www.htaccessredirect.com/


    .htaccess content:
    ---

    Code
    1. ## Rewrite to www
    2. Options +FollowSymLinks
    3. RewriteEngine on
    4. RewriteCond %{HTTP_HOST} ^domain.com[nc]
    5. RewriteRule ^(.*)$ http:## www.domain.com/$1 [r=301,nc]


    ---
    I changed the chown of .htaccess file, but It is not working.
    example:
    domain.com - vu2032.vu2032


    I got a error message:
    ---
    Error 500!/


    Internal Server Error!
    ----


    Wha is the problem?


    KALMI

  • Hööö just use the tool in the customer admin panel -> domain -> edit (or something like that).

  • If the domain.com and domain.hu different users (webspaces), then you can do your redirect in the /etc/apache2/imscp/ folder. Theer you will find for every domain, alais-domain and sub an extra conf-file

    Code
    1. Redirect / http://domain.hu
  • Ahh you can just redirect alias domains. Shouldn't it be also possible with all domain types?

  • If the domain.com and domain.hu different users (webspaces), then you can do your redirect in the /etc/apache2/imscp/ folder. Theer you will find for every domain, alais-domain and sub an extra conf-file

    Code
    1. Redirect / http://domain.hu


    I would like to ask do you know use this method the new "i-MSCP 1.2.1" or have a better solution?

  • Why don't you simply upload a .htaccess file to the domain? That takes a few seconds and is an easy way to do it.
    The mentioned (in your post) method should work too.


    I saw your .htaccess and it can't work like this if I am correct.

    Code
    1. ## Rewrite to wwwOptions +FollowSymLinksRewriteEngine onRewriteCond %{HTTP_HOST} ^domain.com[nc]RewriteRule ^(.*)$ http:## www.domain.com/$1 [r=301,nc]


    Better is:

    Code
    1. Options +FollowSymlinks
    2. RewriteEngine on
    3. RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
    4. RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

    Have a nice day. :)