if (index_php_len) {
entry = index_php;
entry_len = index_php_len;
+ if (entry[0] != '/') {
+ spprintf(&entry, 0, "/%s", index_php);
+ entry_len++;
+ }
} else {
/* assume "index.php" is starting point */
entry = estrndup("/index.php", sizeof("/index.php"));
zend_bailout();
return;
} else {
- char *tmp, sa, *myentry;
+ char *tmp, sa;
sapi_header_line ctr = {0};
ctr.response_code = 301;
ctr.line_len = sizeof("HTTP/1.1 301 Moved Permanently")+1;
sa = *tmp;
*tmp = '\0';
ctr.response_code = 0;
- if (entry[0] == '/' && path_info[strlen(path_info)-1] == '/') {
- myentry = entry + 1;
+ if (path_info[strlen(path_info)-1] == '/') {
+ ctr.line_len = spprintf(&(ctr.line), 4096, "Location: %s%s", path_info, entry + 1);
} else {
- myentry = entry;
+ ctr.line_len = spprintf(&(ctr.line), 4096, "Location: %s%s", path_info, entry);
}
- ctr.line_len = spprintf(&(ctr.line), 4096, "Location: %s%s", path_info, myentry);
*tmp = sa;
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
sapi_send_headers(TSRMLS_C);