vhost

Discussion in 'General' started by SamTzu, Sep 3, 2018.

  1. SamTzu

    SamTzu Active Member

    I'm looking to create a temp script that would change all links in vhost files to point to from www.domain.com to domain.com.
    What line(s) should I modify in vhost file do that?
     
  2. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    i'm not sure you should be doing that with a script. any vhost changes would get wiped out on a resync.
    if it's for every site, you can move the vhost master configuration file into the conf-custom folder and change it there.
    I believe a resync would then rebuild every vhost on that server with those changes.

    if it's only for a couple of sites, you can add the lines as apache directives on the websites options tab.
    I believe the following should do what you require:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
     
  3. SamTzu

    SamTzu Active Member

    That's why it's TEMP script. Only for emergency's.
    Maybe this should be done on Apache service level rather than vconf level?
     
  4. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    you could create a custom conf file with the required rewrites already configured in it, but with a different file name so it doesn't get used normally.
    then you just need a script that will rename the file so that ispconfig will use it and then call the ispconfig api to resync websites on that server. (or resync manually if you prefer)
     

Share This Page