httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prakash Premkumar <>
Subject You don't have permission to access /asd on this server
Date Tue, 07 Jul 2015 11:58:22 GMT
 I am using apache server version 2.4

I have installed apache to a custom location by specifying --prefix during

I'm on mac os x mavericks.

I am using apache module written in c. I'm following the tutorials at the
official site

I installed module given under mod_example.c : The code is give below

/* Include the required headers from httpd */#include
"httpd.h"#include "http_core.h"#include "http_protocol.h"#include
/* Define prototypes of our functions in this module */static void
register_hooks(apr_pool_t *pool);static int
example_handler(request_rec *r);
/* Define our module as an entity and assign a function for
registering hooks  */

module AP_MODULE_DECLARE_DATA   example_module ={
    NULL,            // Per-directory configuration handler
    NULL,            // Merge handler for per-directory configurations
    NULL,            // Per-server configuration handler
    NULL,            // Merge handler for per-server configurations
    NULL,            // Any directives we may have for httpd
    register_hooks   // Our hook registering function};

/* register_hooks: Adds a hook to the httpd process */static void
register_hooks(apr_pool_t *pool) {

    /* Hook the request handler */
    ap_hook_handler(example_handler, NULL, NULL, APR_HOOK_LAST);}
/* The handler function for our module.
 * This is where all the fun happens!
static int example_handler(request_rec *r){
    /* First off, we need to check if this is a call for the "example" handler.
     * If it is, we accept it and do our things, it not, we simply
return DECLINED,
     * and Apache will try somewhere else.
    if (!r->handler || strcmp(r->handler, "example-handler")) return (DECLINED);

    // The first thing we will do is write a simple "Hello, world!"
back to the client.
    ap_rputs("Hello, world!<br/>", r);
    return OK;}

I added my Set Handler as follows

<IfModule example_module>
    <Location /*>
        SetHandler example_module

when I try to access localhost/ , I get "It Works!" screen.

But when I try to access some path in localhost like localhost/asd I get
the following error


You don't have permission to access /asd on this server. Server unable to
read htaccess file, denying access to be safe

Can you please help me solve this ?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message