Category Archives: Apache

SSL and Apache2.4

Generate private key openssl genrsa -out domainname.key 2048 Generate Signing Request openssl req -new -key domainname.key -out domainname.csr

301 redirection with Apache config or .htaccess file

<VirtualHost *:80> DocumentRoot “/home/apache/http/example.co.uk/www” ServerName www.example.co.uk ServerAlias example.co.uk ServerAlias example-ltd.co.uk www.example-ltd.co.uk ServerAlias example.net www.example.net ServerAlias example.com www.example.com ServerAdmin webmaster@www.example.co.uk #Log files CustomLog logs/access/www.example.co.uk.log combined ErrorLog logs/error/www.example.co.uk.log # redirect all non-www traffic Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} !^www\.example\.co\.uk$ RewriteRule ^.*$ http://www.example.co.uk%{REQUEST_URI} [R=permanent,L] </VirtualHost>