So, a lazy sysadmin is often a good sysadmin. Right?
Background. At work we run Roundcube as a webmail frontend. And, we have ”skinned” it a tiny bit so it fits our companys look a bit more than the original layout. Basically I had created a custom logo and replaced the original roundcube_logo.png in the skins/larry directory plus some tiny css changes.
However, everytime I upgrade Roundcube, I had to manually revert these changes. Before you think I’m stupid; I do know you can create your own skins for Roundcube, but I rather not. Why? Well, because I can and because if Roundcube for instance change the default look, I don’t want to miss out.
So, what’s the solution you ask? Apache2 and mod_subsitute! Basically it’s sed in an Apache module. Actually, in the old days, it is called mod_sed ;).
What it does, is that, you guessed it, it searches and replaces in content before it gets delivered by the server. So, you can for instance search for ”roundcube_logo.png” and replace it with ”my_awesome_logo.png”. Pretty nifty. Also, for CSS changes, you can inject your own stylesheet. No modification of the original code needed, it’s magic!
Example config:
<Location />
AddOutputFilterByType SUBSTITUTE text/html
Substitute "s|</head>|<link rel=\"stylesheet\" type=\"text/css\" href=\"//static.whatever.com/roundcube.css\"></head>|ni"
Substitute "s|<img src=\"skins/larry/images/roundcube_logo.png\"|<img src=\"//static.whatever.com/my_awesome_logo.png\"|ni"
</Location>
Place this in your virtual host. I use <
Then you’re free to make your changes in roundcube.css and point to your awesome logo.
So, from now on, whenever you upgrade Roundcube. You can just delete the old installation and unzip the new one and be done with it.
Hello,
how do you install mod-substitute on ubuntu?
apt-cache is not finding the module…
you do this:
`a2enmod substitute`