httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Axel-Stéphane SMORGRAV <>
Subject RE: [users@httpd] passing request to the server
Date Fri, 12 May 2006 12:31:36 GMT
Unless you are doing this in order to familiarise yourself with writing modules for Apache
2.0, I strongly suggest you use a module that already exists and that provides a lot more
flexibility than you module does. That module happens to be mod_rewrite (funny how often it
saves the day!) Combined with mod_proxy it will provide exactly the functionality you need:
RewriteEngine on
RewriteRule ^/tiago/precisas/index1.htm
Actually, you probably do not even need mod_rewrite for this specific problem as you could
instead use:
ProxyPass /tiago/precisas



From: Tiago Semprebom [] 
Sent: Friday, May 12, 2006 1:27 PM
Subject: [users@httpd] passing request to the server


I'm beginning the development of a handler module and one of the tasks 
of this module is change some request uri to another uri. I developed 
this small module (code below), in this small module I compare if an 
incoming request uri is equal a determinate uri if is true I change this 
request uri for an another uri. I need now to direct this request to the 
server for that it can serve this request and send the result to the 

thank's in advanced,

Tiago Semprebom
#include "httpd.h"
#include "ap_config.h"
#include <stdio.h>

static int my_new_handler(request_rec *r)
    int APRStatus = OK;

    if (r->method_number != M_GET)
           return DECLINED;

    if (r->finfo.filetype == 0) {
    ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,"print_test: %s", 
    if (!strcmp(r->uri,"/tiago/precisas/index1.htm")){
        r->uri = "/tiago/imprecisas/index1.htm";
        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,"print_test2: %s", 
        return HTTP_NOT_FOUND;

    return (APRStatus);
static void register_hooks(apr_pool_t *p)

module AP_MODULE_DECLARE_DATA my_handler =
    NULL,              /* create per-directory config structure */
    NULL,              /* merge per-directory config structures */
    NULL,              /* create per-server config structure */
    NULL,              /* merge per-server config structures */
    NULL,              /* command apr_table_t */
    register_hooks     /* register hooks */


Yahoo! Search
Música para ver e ouvir: You're Beautiful, do James Blunt <*>

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message