Archive for February, 2006

Hiding affiliate urls

Let’s say you are a webmaster into a few affiliate programs. You will have URLs which will look like;

http://www.somesite.com/?id=xyz

or

http://www.somesite.com/affiliate/xyz

or something like that.

The best way of getting visitors to not go directly to the site is making them believe (and the searchengines for that matter), that you are not an affiliate but that it is your site.

You do this by registering a domain and then using mod_rewrite in Apache:

Let’s say we registered www.someothersite.com and you want to rewrite, without users be able to see, this url to http://www.somesite.com/?id=xyz, you should set, in Apache;


ServerName www.someothersite.com
RewriteEngine On
RewriteRule (.*) http://www.somesite.com/$1?id=xyz [P]

No-one will be able to see the id in the URL without using frames, iframes etc.

Apache + Webdav + LDAP + Debian

Getting those to work is not that difficult, but a LOT of site keep nagging about using:

LDAP_Server

You will get something like:

Invalid command ‘LDAP_Server’

Prerequisites are:

– Apache 2 under Debian
– Installed and working (open)LDAP

Something like; apt-get install apache2

Symbolic link the dav_load in mods-available/ to mods-enabled/. Do the same with auth_ldap.load and dav_fs.conf and dav_fs.load.

Then add the following to apache2.conf:

Listen 666
<VirtualHost *:666>
DAVLockDB /var/lib/dav/lockdb

Alias /share /home/share

<Location “/share”>
Options Indexes FollowSymLinks
AllowOverride None
order allow,deny
allow from all

DAV On
AuthType Basic

AuthLDAPBindDN cn=admin,dc=mydomain,dc=com
AuthLDAPBindPassword SOMEPASS
AuthLDAPURL ldap://127.0.0.1/ou=People,dc=mydomain,dc=com?uid?sub?(objectClass=*)

AuthName “Repository Access”
Require valid-user
</Location>
</VirtualHost>

/home/share

will be shared now under;

http://somedomain/share

You can use SSL by putting:

SSLEngine On

in the <Location> directive.

I had a problem that I also use Samba and SCP for access on the same system, meaning that there could be a potential sharing access problem; everything must be written with group user and then made 770 directory/file mask.
To fix this, put in /etc/init.d/apache2

umask 0007

somewhere at the start and restart Apache. It will work..