用于首页的G-WAN URL重写不起作用 [英] G-WAN URL rewrite for home page not working
本文介绍了用于首页的G-WAN URL重写不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试为网站主页进行URL重写.这是我的处理程序的简化版本.
I am trying to do a URL rewrite for the site home page. Here is a simplified version of my handler.
int init(int argc, char *argv[])
{
u32 *states = (u32*)get_env(argv, US_HANDLER_STATES);
*states = (1 << HDL_AFTER_READ);
return 0;
}
int main(int argc, char *argv[])
{
xbuf_t *read_xbuf = (xbuf_t*)get_env(argv, READ_XBUF);
xbuf_replfrto(read_xbuf, read_xbuf->ptr, read_xbuf->ptr + 16, " / ", " /?home ");
return 255;
}
void clean(int argc, char *argv[])
{}
基本上,它只是将"/"替换为"/?home".因此,当用户加载"www.domain.com"时,它将为他们提供"home.c"的内容.这是重写的结果.一切看起来都很正确,我不确定是什么引起了问题.
Basically it is just replacing " / " with " /?home ". So when user loaded "www.domain.com" it will give them the content of "home.c". Here is the result of the rewrite. Everything looks right I am not sure what's causing the issue.
原始请求:
GET / HTTP/1.1
Host: localhost:8000
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
重写请求:
GET /?home HTTP/1.1
Host: localhost:8000
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
重写后就是结果.
GET http://localhost:8000/
-- response --
0
推荐答案
此问题已在G-WAN 4+版本上解决
This issue is resolved on G-WAN version 4+
这篇关于用于首页的G-WAN URL重写不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文