Table of Contents

Linux Apache2

Hide server info

in httpd.comf:-

# don't show server tokens
ServerTokens Prod

ServerSignature Off

This shows for the header info:-

% curl --head www.rainsbrook.co.uk
HTTP/1.1 200 OK
Date: Thu, 12 Jun 2025 21:57:11 GMT
Server: Apache
Last-Modified: Wed, 12 Oct 2022 00:26:03 GMT
ETag: "36c-5eacb70120add"
Accept-Ranges: bytes
Content-Length: 876
Vary: Accept-Encoding
Content-Type: text/html; charset=UTF-8

mod-rewrite test

Rewrites can ether be controlled from the main apache.conf or from a .htaccess file in the web root. Testing can be done with the files below (from BOLT CRM):-

.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^.*$ htaccess_tester.html
</IfModule>

Explaination… ^.*$ is anchored to the start of a line with ^, the dot matches any character and the * wildcards any number of matches up to the line end denoted by $, so this redirects any request to the url following (htaccess_tester.html).

htaccess_tester.html
 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>mod-rewrite and htaccess tester.</title>
</head>
 
<body id="home">
If you can see this, you have been rewritten correctly.
 
</body>
</html>