Skip to content

OGo Docs

Sections
Personal tools
You are here: Home » Members » whitemice's Home » Replacing Images With mod_rewrite

Replacing Images With mod_rewrite

Document Actions
How to replace images in the OpenGroupware UI using Apache's mod_rewrite so that you can customize the user interface without modifying the files installed by packages.
The key to using mod_rewrite to 'overload' image references is that mod_rewrite supports the chaining of conditions [RewriteConf] so rewriting rules can only apply to certain requests.

Adding -
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} \.(jpg|jpeg|gif|png)$
RewriteCond /srv/www/htdocs/override/%{REQUEST_FILENAME} -f
RewriteRule ^(.+) /override/$1 [L]
</IfModule>
<Directory /srv/www/htdocs/override>
Order allow,deny
Allow from all
</Directory>
- to the vhost entry for our OpenGroupware instance and we can overload any reference to a request ending in jpg, jpeg, gif or png. But this only happens if a file of the same name exists in our overload directory.

So a request for -
https://tor.morrison.iserv.net/OpenGroupware11.woa/WebServerResources/English.lproj/homepage2.gif
- gets rewritten to -
https://tor.morrison.iserv.net/override/OpenGroupware11.woa/WebServerResources/English.lproj/homepage2.gif
- if and only if a file with a path and name of -
/srv/www/htdocs/override/OpenGroupware11.woa/WebServerResources/English.lproj/homepage2.gif
- exists. Otherwise the file is delivered from the usual place via the Alias directive in you ogo-webui.conf file included into your Apache configuration.

Alias /OpenGroupware11.woa/WebServerResources/ /usr/local/share/opengroupware.org-1.1/www/
<Directory /usr/local/share/opengroupware.org-1.1/www>
Order allow,deny
Allow from all
</Directory>
Created by whitemice
Last modified 2009-02-20 01:14 PM
 

Powered by Plone

This site conforms to the following standards: