2013-02-27 89 views
0

我正在尋找最佳方式(最快),以便我的domain.com直接指向我的/ csp目錄。 在main.c文件中存在什麼指令,我想你會提供給headlers目錄嗎?/csp默認目錄在G-WAN

+0

你是什麼意思直接點?您是否在談論漂亮的URL(沒有'?') – 2013-02-27 15:29:46

回答

0

如果你的目標是有http://domain.com/執行script而不是加載一個靜態頁面,然後使用URI改寫:

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->ptr, read_xbuf->ptr + 16, "/index.html", "/?index_1.c"); 

     // Note: you may have to look for the ending double-CRLF to check 
     //  if there are other pipelined requests to rewrite 
    } 
    return 255; // execute next connection step 
} 

名稱"/?index_1.c"設計爲使用相同長度"/index.html"避免的memmove( )(在重寫期間(具有相同的長度允許就地重寫))。

+0

只有在輸入的網址是「domaine.com/index.html」的情況下,您的解決方案纔有效。如果我們只輸入「domain.com」,那麼index_1頁面將不會收費! 使用xbuf_repl()函數而不是xbuf_replfrto()會更有趣嗎? (通過使用例如xbuf_repl(read_xbuf,「/」,「/?」)以避免每次寫入「?」) 感謝所有;) – 2013-03-02 02:06:46