Apache mod_rewrite module...
Hi, well... I do not know if this is the place to ask it, but... I use two servers... ZServer and apache.... My URL references to Apache example: http://margo.pla.fr/intra/machin.html and I want to use httpd.conf to transform it (only for html and htm files) in http://margo.pla.fr/intra/?machin.html (which is my ZServer) Does someone know the rewrite I sould use.... regular expression are a mistery for me....
Pierre Rougier wrote:
Hi,
well... I do not know if this is the place to ask it, but... I use two servers... ZServer and apache....
My URL references to Apache example: http://margo.pla.fr/intra/machin.html
and I want to use httpd.conf to transform it (only for html and htm files) in
http://margo.pla.fr/intra/?machin.html (which is my ZServer)
Does someone know the rewrite I sould use.... regular expression are a mistery for me....
does "intra" represent that it should be represented by zserver? if so, RewriteRule ^/intra/(.*)htm /intra/?$1htm RewriteRule ^/intra/(.*)html /intra/?$1html should do the trick. http://www.apache.org/docs-1.2/mod/mod_rewrite.html has more information. hope that helps, ~mindlace @ imeme & digicool
My URL references to Apache example: http://margo.pla.fr/intra/machin.html
and I want to use httpd.conf to transform it (only for html and htm files) in
http://margo.pla.fr/intra/?machin.html (which is my ZServer)
Does someone know the rewrite I sould use.... regular expression are a mistery for me....
does "intra" represent that it should be represented by zserver? if so,
RewriteRule ^/intra/(.*)htm /intra/?$1htm RewriteRule ^/intra/(.*)html /intra/?$1html
Well, thanks mindlace, it helps, in fact, now, I use the following line: RewriteRule ^(^([^/]*/)*)([^/]*\.html)$ http://newhost:8080$1?$3 (this line should be usefull for those who want to redirect any *.html URL to your ZServer) which change the URL like I want. The problem is that it makes a redirect, and all my relative addresses in the page are changed too (for instance, my .gif are served by zope too, and I don't want to!) To be clearer, what my product do is: I address Apache, with for instance: http://margo.ina.fr/intra/index.html then, Apache change the URL to: http://margo.ina.fr:8080/intra/?index.html (8080 is my ZServer port) my zope product construct a new page with informations from the "intra" folder, go and search the file ../intra/index.html on the disk, insert it to the builded page (by reading the file) and serve it. The problem is that by doing that, as in the HTML pages, paths are relatives, the redirection change all the relative address to the port 8080 (because the final served URL is on this port), and I want my Images to be served by apache.... (I hope I am clear, but it is hard to explain in an email). A solution would be to write absolute URL for my images, but I am not allowed to do it..... so, I try....... to use Apache not to redirect, but to go and search the result of http://margo.ina.fr:8080/intra/?index.html, in a way which would be transparent to the browser....(the printed URL would keep the Apache one), and I have to say that untill now, I don't manage to do it... Well..... thanks for your attention Pierre
you might want to use apaches proxy module in conjunction with mod_rewrite. from the docs of mod_rewrite (http://www.apache.org/docs/mod/mod_rewrite.html): """ proxy|P' (force proxy) This flag forces the substitution part to be internally forced as a proxy request and immediately (i.e., rewriting rule processing stops here) put through the proxy module. [...] """ i have something like: RewriteRule /(.*) http://stromapp.kleinezeitung.at:8080/$1 [p] you should make sure you got mod_proxy as it is not compiled in by default. have a lot of fun in the voodoo world of mod_rewrite :) peter. On Mon, 22 May 2000, Pierre Rougier wrote: :> :> > My URL references to Apache :> > example: :> > http://margo.pla.fr/intra/machin.html :> > :> > and I want to use httpd.conf to transform it (only for html and htm :> > files) :> > in :> > :> > http://margo.pla.fr/intra/?machin.html (which is my ZServer) :> > :> > Does someone know the rewrite I sould use.... regular expression are a :> > mistery for me.... :> :> does "intra" represent that it should be represented by zserver? if so, :> :> RewriteRule ^/intra/(.*)htm /intra/?$1htm :> RewriteRule ^/intra/(.*)html /intra/?$1html :> :> : :Well, thanks mindlace, it helps, in fact, now, I use the following line: :RewriteRule ^(^([^/]*/)*)([^/]*\.html)$ http://newhost:8080$1?$3 :(this line should be usefull for those who want to redirect any *.html URL :to your ZServer) : :which change the URL like I want. The problem is that it makes a redirect, :and all my relative addresses in the page are changed too (for instance, my :.gif are served by zope too, and I don't want to!) : :To be clearer, what my product do is: : :I address Apache, with for instance: :http://margo.ina.fr/intra/index.html : :then, Apache change the URL to: :http://margo.ina.fr:8080/intra/?index.html (8080 is my ZServer port) : :my zope product construct a new page with informations from the "intra" :folder, go and search the file ../intra/index.html on the disk, insert it :to the builded page (by reading the file) and serve it. : :The problem is that by doing that, as in the HTML pages, paths are :relatives, the redirection change all the relative address to the port 8080 :(because the final served URL is on this port), and I want my Images to be :served by apache.... : :(I hope I am clear, but it is hard to explain in an email). :A solution would be to write absolute URL for my images, but I am not :allowed to do it..... : :so, I try....... to use Apache not to redirect, but to go and search the :result of http://margo.ina.fr:8080/intra/?index.html, in a way which would :be transparent to the browser....(the printed URL would keep the Apache :one), and I have to say that untill now, I don't manage to do it... : :Well..... thanks for your attention : :Pierre : : :_______________________________________________ :Zope maillist - Zope@zope.org :http://lists.zope.org/mailman/listinfo/zope :** No cross posts or HTML encoding! ** :(Related lists - : http://lists.zope.org/mailman/listinfo/zope-announce : http://lists.zope.org/mailman/listinfo/zope-dev ) : -- _________________________________________________ peter sabaini, mailto: sabaini@niil.at -------------------------------------------------
Pierre Rougier wrote:
The problem is that by doing that, as in the HTML pages, paths are relatives, the redirection change all the relative address to the port 8080 (because the final served URL is on this port), and I want my Images to be served by apache....
What I think you need to do is use SiteAccess so that it strips out the port. You can use an access rule like so: <dtml-let basename="_.string.join(_.string.split(HTTP_HOST, ':')[-2:-1])"> <dtml-call "REQUEST.set('SiteRootBASE','http://'+basename)"> </dtml-let> Then, zope will generate all its links with a base that excludes the port, so Apache will always get the request and apply its rewrite rules. You have to do this, because zope always adds a base url tag to pages, so relative URL's think they go to zope. Hope that helps, -- ethan mindlace fremen Zopista Community Liason
mindlace wrote:
What I think you need to do is use SiteAccess so that it strips out the port. You can use an access rule like so: <dtml-let basename="_.string.join(_.string.split(HTTP_HOST, ':')[-2:-1])"> <dtml-call "REQUEST.set('SiteRootBASE','http://'+basename)"> </dtml-let>
You may have to change the string.split if the subdomain is important. ~ethan
well, this can sound a newbie question... well,it is one... in fact I never used a zope product from the zope site. I downloaded the SiteAccess product..... what do I have to do to use it??? thanks for your attention (special thanks for mindlace)
in fact I never used a zope product from the zope site. I downloaded the SiteAccess product..... what do I have to do to use it???
I was about to just send you the installation instructions when I saw that they are pretty meager. Actually, very. (shame shame) 1) Go to your root Zope directory 2) Unpack (tar, zip) the file 3) Restart Zope To use it consult http://yyy.zope.org/Members/4am/SiteAccess/info The basics are you create a DTML Method in your Zope root directory and tell it about each of the folders and what domain name they are hosting and then in each folder you add a site access instance (from the drop down menu) with nothing in it. J
participants (4)
-
J. Atwood -
mindlace -
Peter Sabaini -
Pierre Rougier