Forums / Setup & design / I need some help with regular expressions / Apache rewritrerule

I need some help with regular expressions / Apache rewritrerule

Author Message

Nick Woods

Thursday 08 April 2004 8:06:38 am

I've ecently implemented the Apache rewrite rule (see http://ez.no/ez_publish/documentation/installation/virtual_host_setup ) and although the main website still works I now find that Squirrelmail has been broken and Ezpublish thinks that the Squirrelmail logon is an ezpublish module

This is what I added to Apaches httpd.conf file :-
RewriteEngine On
RewriteRule !(^/design|^/var/.*/storage|^/var/storage|^/var/.*/cache|^/var/cache|^/extension/.*/design|^/kernel/setup/packages).*\.(gif|css|jpg|png|jar|js|ico|pdf|swf)$ /index.php

I guess I need to tune it to allow squirrelmail to work - the path is squirrelmail/src/login.php

Can someone tell me what Ineed to do to the Rewriterule to fix this ?

Thanks

Björn Dieding@xrow.de

Tuesday 13 April 2004 5:40:14 am

try this
RewriteEngine On
RewriteRule ^/squirrelmail(.*)$ /squirrelmail$1 [L]
RewriteRule !(^/design|^/var/.*/storage|^/var/storage|^/var/.*/cache|^/var/cache|^/extension/.*/design|^/kernel/setup/packages).*\.(gif|css|jpg|png|jar|js|ico|pdf|swf)$ /index.php

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Nick Woods

Tuesday 13 April 2004 1:15:17 pm

Thanks Bjorn, I'll try this out.

Nick Woods

Wednesday 14 April 2004 3:15:42 pm

Hi Bjorn

Unfortunately it didnt work. After a bit of digging around in my httpd.conf files (it was setup by the ISP when we rented the server) I eventually found that there was an alias command for /squirrelmail and the rewrite rule kept clashing with it.

Rather than change the alias (because of the way the webser appliance is set up) i found that using rewritecond worked :-

RewriteEngine On
RewriteCond %{REQUEST_URI} !(^/squirrelmail(.*))
RewriteRule !(^/design|^/var/.*/storage|^/var/storage|^/var/.*/cache|^/var/cache|^/extension/.*/design|^/kernel/setup/packages).*\.(gif|css|jpg|png|jar|js|ico|pdf|swf)$ /index.php

Thanks once again for your help - although your idea didnt work you did give me the confidence to hunt around and work it out for myself !