title: URL rewrite on G-WAN for .JPG
body: <p>I am testing G-WAN server and I'd like using rewrite rules.</p>
  
  <p>With apache the rule is :</p>
  
  <pre><code>RewriteRule ^(.+)-(.+)-(.+)-1.jpg$ imagesproduitnew/$3/$2.jpg [L]
  </code></pre>
  
  <p>I am trying to do it by handlers <code>JPG</code>, but I have lot of difficulties.</p>
  
  <p>Has anybody already done something like that ?</p>
  
  <hr>
  
  <p>My handlers is called url_wr.c in the path /0.0.0.0_80/#0.0.0.0/handlers
  Here is the script</p>
  
  <pre><code>int init(char *argv[], int argc);
  
  int main(int argc, char *argv[])
  {
     const long state = (long)argv[0];
     if(state == HDL_AFTER_READ)
     {
        xbuf_t *read_xbuf = (xbuf_t*)get_env(argv, READ_XBUF);
        xbuf_replfrto(read_xbuf, read_xbuf-&gt;ptr, read_xbuf-&gt;ptr + 16, "/blog", "/?blog");
     }
     return 255; // execute next connection step
  }
  
  int clean(char *argv[], int argc);
  </code></pre>
  
  <p>In gwan.log, it is not writen loaded url_wr.c
  If I put printf in each function, it doesn't work.
  The servlet bloc.c works well.</p>
  
  <p>I also tried tu put the code in handlers/main.c and in the root of gwan directory.</p>
  
  <p>I have only a error.log file for the site which says just error404 without any details of the handlers.</p>
  
  <p>Thanks by advance for your support</p>