Forums / Install & configuration / Exclude certain URIs from rewrite rule

Exclude certain URIs from rewrite rule

Author Message

James Ward

Monday 26 May 2003 6:27:19 pm

I currently have a virtual host setup configured and working fine. My problem is that my server was initialy setup to allow statistics and webmail access to users via the urls www.example.com/stats and www.example.com/webmail.

With the rewrite rule given in the eZ manual these urls are just interpreted as incorrect ez publish modules. Is there anyway to exclude certain urls from the rewrite rule?

working at www.wardnet.com
blogging at www.jamesward.ca

Paul Borgermans

Tuesday 27 May 2003 6:24:18 am

This should do the trick (I suppose a trailing slash and more will make up the real-life urls)

RewriteRule !(^/stats/.*$|^/webmail/.*$|\.(gif|css|jpg|png|js|asf|avi|wmv|swf|xsl|jar))$ /<your path to>/index.php

You will need to avoid the words stats and webmail as first level nodes in your site when using url_alias (nice urls).

hth

Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

James Ward

Tuesday 27 May 2003 10:09:14 am

Thanks Paul,
This worked like a charm for the "stats" page but the "webmail" page still comes up with:
Module not found
The requested module 'openwebmail-cgi' could not be found.
The page title changes to "Open Webmail" which is correct but the error is all thats displayed. Any thoughts?

working at www.wardnet.com
blogging at www.jamesward.ca

Jonny Bergkvist

Wednesday 28 May 2003 12:38:31 am

If openwebmail.cgi is in located your /cgi-bin/-folder, then I think you should also try to exclude this folder in the RewriteRule.

James Ward

Thursday 29 May 2003 12:00:35 am

I tried excluding cgi-bin and openwebmail-cgi but I still received the same error message. I believe the problem is the fact that webmail is not an actual folder in my web directory. Another possible problem is the fact that openwebmail appears to use frames. Here is the source from my error loading module page:
<HTML>
<HEAD><TITLE>Open WebMail</TITLE></HEAD>
<FRAMESET rows=100%,* border=0 frameborder=0 framespacing=0 framecolor=#000000>
<FRAME SRC=/openwebmail-cgi/openwebmail.pl>
<FRAME SRC=white.html>
</FRAMESET>
</HTML>

Certainly not what I expected, but it does explain why the title changed. Any other suggestions?

working at www.wardnet.com
blogging at www.jamesward.ca

James Ward

Thursday 29 May 2003 12:16:25 am

O.K. I'm a little closer. I added ^/openwebmail-cgi/openwebmail.pl.*$ to my rewrite rule. Now when I add webmail to the url I am prompted with my openwebmail login screen. Unforunately, if I type in the correct user name and password I get the same error page:
Module not found
The requested module 'openwebmail-cgi' could not be found.

If I enter an incorrect user name and password everything works fine, it tells me it wrong and asks me to try again.

There must be another .pl file I need to include in my rewrite rule.

working at www.wardnet.com
blogging at www.jamesward.ca

Paul Borgermans

Thursday 29 May 2003 1:47:45 pm

Yes, but like this it may become a bit too hard for the simple solution I mentioned.

I would advise you to read slowly the rewrite (mod_rewrite) docs for apache. A lot can be done, but mod_rewrite is not that obvious. Try adding a set of rewrite rules before the one for ez publish and terminate the last one with [L]. With some luck you may have the entire cgi path work without interference from index.php of ezp rather fast. I'm not an apache mod_rewrite expert,so can't help you more on this now. Sorry.

Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans