Redirect domains without www (e.g. to with apache rewrite rules

If all your visitors shall access your website with a URL like and not without www, use the following apache rewrite rule for redirecting them.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www
RewriteRule (.*) http://www.%{HTTP_HOST}$1 [L,R]

The apache rewrite rule can be added in a .htaccess file in the website root directory or if you use ISPConfig 2 or 3, you can also add the rwrite rule into the apache directives field of the website.

How to redirect an HTTP connection to HTTPS in apache webserver

Http connections can be redirected to https with the apache mod_rewrite module, which should be available in every apache installation. Create a file with the name .htaccess in the website root directory which contains the following lines:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

If you use ISPConfig 2 or 3, you can add these lines also in the apache directives field of  the website settings form instead of adding them to a .htaccess file. But the approach with the .htaccess file will work on ISPConfig as well.

How to add a root SSL certificate in ISPConfig 2

Most SSL authorities (like godaddy or instantssl) send you a root certificate which has to be installed beside the SSL certificate to proove that the SSL cert is signed from a trusted authority. To add such a root SSL certificate in ISPConfig, copy the file to the ssl subfolder of the website and then add this line into the apache directives field of the website in ISPConfig:

SSLCACertificateFile /var/www/www.yourdomain.tld/ssl/ca.txt

The path to the root certificate file has to be changed to match the path on your system.

Change the language of webalizer statistics on Debian and Ubuntu Linux

The language of the generated Webalizer statistics is statically compiled into the Webalizer binary. To change the language, Webalizer has to be recompiled. In the following example, I will recompile Webalizer to change the language to german.

Uninstall Webalizer and install the GD library:

apt-get remove webalizer
apt-get install libgd2-xpm-dev

Download the latest Webalizer sources and uncompress the tar archive:

cd /tmp
tar xzf webalizer-2.23-08-src.tgz
cd webalizer-2.23-08

Reconfigure and compile Webalizer:

./configure --with-language=german
make install

Create a symlink so that other applications find the Webalizer binary in the common place:

ln -s /usr/local/bin/webalizer /usr/bin/webalizer


rm -f /tmp/webalizer-2.23-08-src.tgz
rm -rf /tmp/webalizer-2.23-08

Thanks to planet_fox for this FAQ.

How to access a namebased website without a DNS record

If you want to access a namebased website that you created e.g. in ISPConfig before the DNS records are setup, edit the hosts file on your workstation computer and add a line like this:

Replace the IP address with the IP of your server and with the domain name of the website.

The hosts file on linux and MAC systems is /etc/hosts, on Windows systems the hosts file is C:\Windows\system32\drivers\etc\hosts

The above trick also works if you want to run a website in your internal network (intranet) without having a DNS server availalble for local dns resolving.

Postfix: “queue file write error”

If you get an error like:

Aug 21 12:41:03 webb4 postfix/sendmail[11234]: fatal: web1_user(12967): queue file write error

in your mail log, then the vale for message_size_limit in postfix is too low. Edit postfix

vi /etc/postfix/

and set the message size limit to a higher value. E.g.

mesage_size_limit = 900000000

and restart postfix:

/etc/init.d/postfix restart

If there is no message_size_limit set in, just add the line.

Set stricter PHP settings to secure joomla and wordpress installations

If you run a joomla or wordpress installation with mod_php, the following settings in the vhost configuration file or the "Apache directives" field in ISPConfig can be used to set stricter securitypolicys. This helps limit the impact of a possible hack to this websiteand protect the other sites on the server.

php_admin_value disable_functions "show_source system shell_exec passthru exec phpinfo popen proc_open"
php_admin_flag allow_url_fopen Off
php_admin_value session.save_path "/var/www/webXXX/phptmp/"
php_admin_value open_basedir "/var/www/webXXX/:/tmp"


disable_functions disables functions that have a potential security impact e.g. because they allow the execution of external applications.

allow_url_fopen disables the ablity to open files via an URL.

session.save_path sets the path were php stores its session files. For ISPConfig 2, the path is e.g. "/var/www/webXXX/phptmp/" and for ISPConfig 3 the path is like "/var/www/clients/client1/web1/tmp/" If you dont use ISPConfig, set this path to a directory which is writable for the webserver user. the directory should be unique for every website.

open_basedir sets the path were php scripts are allowed to open files. For ISPConfig 2, the path is like  "/var/www/webXXX/" and for ISPConfig 3 the path is like "/var/www/clients/client1/web1/" If you dont use ISPConfig, set this path to a the root directory of this vhost. With :/tmp we allow php scripts to use also the /tmp directory of the server.

Webalizer stats only showing 1 or 2 days?

If webalizer statistics of your website are only showing the last 1 or two days instead of all days since the website has been created, you have to activate incremental processing in the webalizer configuration file (/etc/webalizer.conf or /etc/webalizer/webalizer.conf depending on the Linux distribution).

vi /etc/webalizer/webalizer.conf

Change the line:

# Incremental     yes


Incremental     yes