httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thuan Tran" <>
Subject [users@httpd] all requests are rooted to apache custom module
Date Tue, 18 May 2004 14:23:42 GMT
Hi all,
I am new with Apache. I wrote a apache custom module and activated it with
apxs tool as:
bin/apxs -i -a -c mod_tut1.c

After that, these is a directive to load my module in httpd.conf as

# Example:
# LoadModule foo_module modules/
 LoadModule tut1_module        modules/

But after restarting Apache server, all requests are rooted to this module.
For example, I tried to access http://localhost:80, it always returns result
as following:

Testing Who would take this book seriously if the first example didn't say
"hello world"?

I expect only whenever I access http://localhost:80/tut1 my module must be
Please give a hand to solve it.

could I set the handler for my module? how could I do that?

Thanks in advance,

----------- This is source code of my module------------------------

#include "httpd.h"
#include "http_config.h"
#include "http_core.h"
#include "http_log.h"
#include "http_protocol.h"
#include "ap_compat.h"

static int mod_tut1_method_handler (request_rec *r)
const char* hostname;
  r->content_type = "text/html";
// ap_send_http_header(r);
 hostname =
  ap_rputs("<HTML>\n"                           ,r);
 ap_rputs("<HEAD>\n"                           ,r);
 ap_rputs("<TITLE>Hello There</TITLE>\n"       ,r);
 ap_rputs("</HEAD>\n"                          ,r);
 ap_rputs("<BODY>\n"                           ,r);
 ap_rprintf(r,"<H1>Hello %s</H1>\n"            ,hostname);
 ap_rputs("Testing Who would take this book seriously if the first example
didn't\n",r);   ap_rputs("say \"hello world\"?\n"             ,r);
 ap_rputs("</BODY>\n"                          ,r);
 ap_rputs("</HTML>\n"                          ,r);
  return OK;

static void mod_tut1_register_hooks (apr_pool_t *p)
        ap_hook_handler(mod_tut1_method_handler, NULL, NULL, APR_HOOK_LAST);

module AP_MODULE_DECLARE_DATA tut1_module =
        mod_tut1_register_hooks,                        /* callback for
registering hooks */

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