Apache Cache Headers

Here are some nice Apache configuration entries that will increase your website performance. They can be placed in a .htaccess file: <IfModule mod_headers.c> ## # Add a Vary Accept-Encoding header for the compressed resources. If you # modify the file types above, make sure to change them here accordingly. ## Header unset ETag # Header set […]

Apache – Allow crossite calls

To Allow crossite calls via Ajax or for Fonts and so one, from specific subdomains: <IfModule mod_headers.c> SetEnvIfNoCase Origin “https?://(www\.|sub1\.|sub2\.|sub3\.|sub4\.)?(ask-sheldon\.com)(:\d+)?$” AccessControlAllowOrigin=$0 Header set Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin Header set Access-Control-Allow-Credentials true </IfModule> Or you can place a crossdomain.xml in your DocumentRoot (does not work everywhere) <?xml version=”1.0″?> <cross-domain-policy> <allow-access-from domain=”*.ask-another-sheldon.com” /> <allow-access-from domain=”*.ask-anothernother-sheldon.com” /> </cross-domain-policy>  

Protect directory with username and password

 To protect a folder with an password prompt, you only need to place a .htaccess and a .htpasswd into the target directory. .htaccess AuthUserFile /root/path/to/.htpasswd AuthGroupFile /dev/null AuthName “Title for the popup window” AuthType Basic <Limit GET> require valid-user </Limit> .htpasswd username:NiceCryptOrMD5encryptedPasswordHash The passwort can be crypted via crypt or MD5. On http://de.selfhtml.org/servercgi/server/htaccess.htm#verzeichnisschutz you can find […]

Virtual hosts (vHosts)

Activate a vHost $> a2ensite 000-ask-sheldon.com In this example 000-ask-sheldon.com refers to the vhost configuration that is defined under /etc/apache2/sites-available/000-ask-sheldon.com . a2ensite creates a symbolic link under /etc/apache2/sites-enabled with the name 000-ask-sheldon.com that points to the configuration file /etc/apache2/sites-available/000-ask-sheldon.com. So you can see, that you can do it manually too.  Deactivate a vHost $> a2dissite 000-ask-sheldon.com In contrast […]