这个重写规则似乎在一次请求时运行了我的cgi脚本joppli.bot
3次。
RewriteEngine On
# remove trailing slash
RewriteRule ^(.*)/$ /$1 [L,R=301]
# add trailing slash
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteRule ^.*[^/]$ /$0/ [L,R=301]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ joppli.bot [NC,L]
DirectoryIndex joppli.bot
如何为evry请求创建一次仅启动cgi脚本的重写规则?
#include "fcgi_stdio.h"
#include <stdlib.h>
void main(void)
{
int count = 0;
while(FCGI_Accept() >= 0)
printf("Content-type: text/html\r\n"
"\r\n"
"<title>FastCGI Hello!</title>"
"<h1>FastCGI Hello!</h1>"
"Request number %d running on host <i>%s</i>\n",
++count, getenv("SERVER_NAME"));
}