我有一个C/CGI应用程序。为了重定向到同一页面在C/CGI中处理后URL被更改
const char * redirect_page_format =
"<html>\n"
"<head>\n"
"<meta http-equiv=\"REFRESH\"\n"
"content=\"0;url=%s\">\n"
"</head>\n"
"</html>\n";
printf (redirect_page_format, getenv (URL));
在此之前的URL是这样的“http://ipaddress/page.html”。
对于某些页面,我可以正确重定向。
但一些HTML页面,
的网址不具有像一个字符追加这个 “http://ipaddress/page.htmlP”
或网址改变像下列之一:
编辑1
我将通过查询字符串发送URL。它将通过命令得到。
的getenv( “QUERY_STRING”)
通过解析查询字符串,URL可以得到,它是作为参数给出重定向命令。
printf(redirect_page_format,getenv(URL));
你确定环境变量'URL'总是被定义的吗?它里面可以有'''''你有'#include'? –
2010-01-13 12:27:30