|   | ![[ Previous ]](navbprev.gif)  ![[ Contents ]](navbhome.gif)  ![[ Index ]](navbhelp.gif)  ![[ Next ]](navbnext.gif)  | 
    void Ns_SetUrlToFileProc(
    char *hserver,
    Ns_UrlToFileProc *proc
    );
Ns_SetUrlToFileProc() sets the procedure pointed to by proc to be called by Ns_UrlToFile() to map a URL to a file pathname.  The interface of the procedure pointed to by proc must have the same interface as Ns_UrlToFile().
A NULL proc argument to Ns_SetUrlToFileProc() causes Ns_UrlToFile() afterwards to call a default procedure.
    int
    Ns_ModuleInit(char *hServer, char *hModule)
    {
        Ns_SetUrlToFileProc(hServer, AliasedUrlToFile);
    
        return NS_OK;
    }
    
    static int
    AliasedUrlToFile(Ns_DString *dest, char *hServer, char *relpath)
    {
        char   *pageRoot;
    
        /*
         * construct dest from hServer and relpath 
         */
    
        pageRoot = Ns_PageRoot(hServer);
        Ns_MakePath(dest, pageRoot, relpath, NULL);
    
        return NS_OK;
    }
See the alias C example for a more comprehensive example.