Nisses blog

Slå mig, älska mig

Archive for July, 2009

Disable hot linking in Apache

I’ve came across a problem where I don’t want it to be possible to download content from the web server. This is called hot linking or some say bandwidth stealing. This can be prevented by using a .htaccess in the directory.

In this file you add the following lines.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ http://www.mydomain.com/logo.gif [R,L] 

The forth line will redirect the user to the URL stated. Happy hacking!

posted by Nisse in Technical and have No Comments

Backup all you SQL server databases with one script

I’ve been using this script for a while to backup my databases. This is very use full if you have a SQL 2005 Express installation since the backup capabilities in it is non existing or very limited. What you need to do is to attach a database to you server. In it is a stored procedure that backup every other database including itself.

Then you call the stored procedure with sqlcmd and schedule the command. Easy as pie.

Steps

1. Download the file
2. Unzip to you location
3. Edit the .CMD files to match your enviroment. Path to files and server
4. Schedule execution of the .CMD files.
5. Backup the files dumped in the location of the .CMD files.

SQLBackup.zip (116.43 kb)

posted by Nisse in Technical and have No Comments