我正在用c ++编写cgi脚本。只要我进入准确的网址,所有工作都很顺利:http://localhost:90/joppli.bot
现在我试图从一切到我的cgi脚本进行简单的重定向。例如:
http://localhost:90/
http://localhost:90/foo
http://localhost:90/foo/bar
...应该呈现与输入http://localhost:90/joppli.bot
的.htaccess
RewriteEngine On
RewriteRule (.+)/$ /$1 [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]
虚拟主机
<VirtualHost *:90>
DocumentRoot /var/www/joppli-bot
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so
SetHandler fastcgi-script
<Directory "/var/www/joppli-bot">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/www/joppli-bot/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/www/joppli-bot/log/apache2/access.log combined
</VirtualHost>
/var/www/joppli-bot
.htaccess
joppli.bot -> /home/erik/NetBeansProjects/joppli.bot/dist/Debug/GNU-Linux-x86/joppli.bot
log
+ apache2
+ access.log
+ error.log
答案 0 :(得分:2)
感谢Justin Iurman谁写了以下评论,女巫解决了大部分内容:
在
<Directory "/var/www/joppli-bot">
阻止中,替换 AllowOverride无 通过 AllowOverride All (否则您的htaccess被禁用)
我还在.htaccess文件的底部添加了DirectoryIndex joppli.bot
,以便将所有流量从根目录路由到脚本。