Apache
Blocking cross sitem access to images
If you don't like that other sites link to your images, then you can use this trick:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} \.(jpe?g|gif|png)$ [NC]
RewriteCond %{HTTP:Referer} !=""
RewriteCond %{HTTP_HOST}:%{HTTP:Referer} !^([^:]*):https?://\1/.* [NC]
RewriteRule . - [G]This looks at requests for jpg, jpeg, gif & png, if a referer header is not empty (direct linking is ok), and the host of the request is not the host in the referer, send an "410 Gone" response.
Creating a web overlay
This is very usefull if you want to edit the CSS or JavaScript of some site. You simply start Apache2 as a proxy, that sends a local file if it exists, otherwise fetches the remote version.
Listen 127.0.0.1:8080
<VirtualHost 127.0.0.1:8080>
UseCanonicalName Off
ProxyRequests On
RewriteEngine On
DocumentRoot /home/user/proxy-htdocs/
RewriteCond %{REQUEST_URI} ^http://([^\?]*/[^\?]*)(.*)
RewriteCond %{DOCUMENT_ROOT}/%1/index.html -f
RewriteRule . %{DOCUMENT_ROOT}/%1/index.html [L]
RewriteCond %{REQUEST_URI} ^http://([^\?]*/[^\?]*)(.*)
RewriteCond %{DOCUMENT_ROOT}/%1%2 -f
RewriteRule . %{DOCUMENT_ROOT}/%1%2 [L]
RewriteCond %{REQUEST_URI} ^http://([^\?]*/[^\?]*)(.*)
RewriteCond %{DOCUMENT_ROOT}/%1 -f
RewriteRule . %{DOCUMENT_ROOT}/%1%2 [L]
AddDefaultCharset Off
<Directory /home/user/proxy-htdocs/>
Options Indexes FollowSymLinks
AllowOverride None
Order Deny,Allow
Allow from all
</Directory>
<Proxy *>
AddDefaultCharset off
Order Deny,Allow
Allow from all
</Proxy>
CustomLog /var/log/apache2/proxy.log combined
</VirtualHost>In this case the url "http://bogeskov.dk/" would have the content of "/home/user/proxy-htdocs/bogeskov.dk/index.html" and "http://bogeskov.dk/tree/tree.js" would be from "/home/user/proxy-htdocs/bogeskov.dk/tree/tree.js". Then you can test your style sheet against your real site, before uploading it to for the world to see.