mod_rewrite in iVhosts_ispconfig.conf get overwritten with change to domain...

Discussion in 'Installation/Configuration' started by joshenry, Feb 14, 2007.

  1. joshenry

    joshenry New Member

    Hey, I've been trying to find a place where I can put a rewrite to go from http://*.mydomain.com/webmail -> https://www.mydomain.com/webmail.

    I've got it working however if I ever make a change to the domain it will over write the Vhosts_istpconfig.conf file and then it won't work anymore. Is there another place where apache will find the rewrite and process it properly? I've tried in the httpd.conf file, as well as .htaccess file with no go.

    Thanks for any assistance.
     
  2. Dy0nisus

    Dy0nisus New Member

    Hi!

    Everytime you make a change to a Web, ISPConfig rewrites the vhost - file of Apache.

    You have to implement your rewrite - rule in the config file that is responsible for creating the config file ...

    edit:

    Code:
    /root/ispconfig/scripts/lib/config.lib.php
     
  3. joshenry

    joshenry New Member

    Gah... :-/ don't know where I need to add the information in that file. Am I able to add it in a different place in httpd.conf or anything like that?
     
  4. martinfst

    martinfst ISPConfig Developer ISPConfig Developer

    Rewrite rules also work in .htaccess files, which you can put in your web directory, These won't be overridden.
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    The correct solution is either to add the rwrite rule in a .htaccess file as martinfst pointed out or to add it in the apache directives field of the website in ISPConfig. The content of the apache directives field is inserted in the vhost by ISPConfig.

    Vhosts_istpconfig.conf shall never be dited manually and editing the config.lib.php is also not recommended beacuse you will loose all cahnges when you update ISPConfig.
     
  6. joshenry

    joshenry New Member

    Excellent, I'll give that a try.
    Thanks again for your help.
     
  7. joshenry

    joshenry New Member

    I can't seem to get the .htaccess file to see the rewrite rules. If I put a redirect in there that will work to a point but isn't going to do what I want it to do. Here is what I'm trying to do.

    If someone accesses:
    http://webmail.mydomain.com
    https://webmail.mydomain.com
    http://*.mydomain.com/webmail
    https://*(other then www).mydomain.com/webmail

    I need it to go to:
    https://www.mydomain.com/webmail

    I think I have the rule right:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} webmail.mydomain.com$ [NC]
    RewriteRule ^/(.*)$ https://webmail.mydomain.com/$1 [R,L]
    RewriteRule ^/webmail/(.*)$ https://webmail.mydomain.com/$1 [R,L]

    I've seen people writing rewrite rules in <IfModule mod_rewrite.c></IfModule> tags, I've tried with and without either way the site will not access any rewrite command I put in there.

    Thanks again for any help.
     
  8. falko

    falko Super Moderator ISPConfig Developer

  9. joshenry

    joshenry New Member

    Yup, checked that and changed it so the web dir has AllowOverride All applied to it.
    Commands in the .htaccess in the /web dir work just not the rewrite command. I tried a redirect and it works but I need a rewrite cause the redirect doesn't do what I want it to.

    Thanks again.
     
  10. falko

    falko Super Moderator ISPConfig Developer

Share This Page