quick search:

Generate apache RewriteRule

Submitted by: divinerites
Last Edited: 2001-07-27

Category: DTML

Average rating is: 4.0 out of 5 (2 ratings)

If you need a simple Apache configuration, you can generate the Apache RewriteRules with this snipplet.

Source (Text):
<dtml-call "REQUEST.set('split_nom_host',_.string.split(REQUEST['HTTP_HOST'],':',1))">
<dtml-call "REQUEST.set('NOM_HOST',split_nom_host[0])">

 NameVirtualHost <dtml-var "REQUEST['NOM_HOST']">
 <VirtualHost <dtml-var "REQUEST['NOM_HOST']">>
  ServerName <dtml-var "REQUEST['NOM_HOST']">
  <IfModule mod_rewrite.c>
   RewriteEngine On
   Proxypass / <dtml-var "REQUEST['SERVER_URL']">/VirtualHostBase/<dtml-var "REQUEST['SERVER_URL']">/
   RewriteRule ^(./*) <dtml-var "REQUEST['SERVER_URL']">/VirtualHostBase/http/<dtml-var "REQUEST['NOM_HOST']">:80/$1 [P,L]

Just add a VirtualHostMonster in your root, and this RewriteRule in you Apache vhost.conf file, and you can use the 80 standard port for Zope.

This is a basic use for Apache.

You can easily adapt it to your own needs (have a look at the nice How-Tos).


Clever by pup - 2001-07-27