Apache 修复错误后,CGI脚本不再可用https://www 重定向

Apache 修复错误后,CGI脚本不再可用https://www 重定向,apache,mod-rewrite,https,url-rewriting,cgi,Apache,Mod Rewrite,Https,Url Rewriting,Cgi,我在跟帖 我终于成功地生成了一个通配符证书*.website.com,它允许我使用重写规则从一开始重定向到 现在,我面临另一个问题:CGI-bin目录中的CGI脚本不再工作,例如: 我使用以下重写规则来获取https://www.website.com至https://webiste.com(使用apache背后的zope框架): Zope的产量和产量: 127.0.0.1 - - [01/Mar/2020:10:49:01 +0200] "GET /++vh++https:www.websit

我在跟帖

我终于成功地生成了一个通配符证书
*.website.com
,它允许我使用重写规则从一开始重定向到

现在,我面临另一个问题:
CGI-bin
目录中的
CGI
脚本不再工作,例如:

我使用以下重写规则来获取
https://www.website.com
https://webiste.com
(使用apache背后的zope框架):

Zope的产量和产量:

127.0.0.1 - - [01/Mar/2020:10:49:01 +0200] "GET /++vh++https:www.website.com:443/++/cgi-bin/awstats.pl HTTP/1.1" 404 102 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:73.0) Gecko/20100101 Firefox/73.0"
更新2 解决我的问题的一些有趣结果:

如果我这样做:1)

i、 e:

<VirtualHost *:443>

...

# REWRITE
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/cgi-bin/awstats [NC]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^/(.*)  https://localhost:8443/++vh++https:%{SERVER_NAME}:443/++/$1 [P,L]

...
</VirtualHost>

...
#重写
重新启动发动机
重写cond%{REQUEST_URI}^/cgi bin/awstats[NC]
重写条件%{HTTP_HOST}^www\.(.*)$[NC]
重写规则^/(*))https://localhost:8443/++vh++https:%{SERVER_NAME}:443/++/$1[P,L]
...
然后,无法实现从https://到https://的重定向,但可以通过在浏览器中键入
CGI
脚本https://website.com/cgi-bin/awstats.pl


我如何组合这两种不同的配置,以便同时提供重定向和
CGI
脚本?

您在解决方法中缺少的是,重写条件仅与紧随其后的单个重写规则相关联

如果要在请求CGI时跳过对zope的重定向,请在该规则前面加上一个条件以排除该特定重写规则:

RewriteCond %{REQUEST_URI} !^/cgi-bin/awstats
# existing rule from Question
RewriteRule ^/(.*)  https://localhost:8443/++vh++https:%{SERVER_NAME}:443/++/$1 [P,L]

您在apache的error.log文件中看到了什么?也许你给zope用的就是这个。我确信很难解决这个问题,因为它似乎与编程无关。关于web服务器配置的问题在StackExchange的网站上更合适,也更容易得到答案。太好了,它可以工作了!我不知道单一重写规则,它必须立即遵循重写条件。当做
<VirtualHost *:443>

...

# REWRITE
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/cgi-bin/awstats [NC]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^/(.*) https://website.com/$1 [R=301,L]
RewriteRule ^/(.*)  https://localhost:8443/++vh++https:%{SERVER_NAME}:443/++/$1 [P,L]

...
</VirtualHost>
 `RewriteRule ^/(.*) https://website.com/$1 [R=301,L]` )
<VirtualHost *:443>

...

# REWRITE
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/cgi-bin/awstats [NC]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^/(.*)  https://localhost:8443/++vh++https:%{SERVER_NAME}:443/++/$1 [P,L]

...
</VirtualHost>
RewriteCond %{REQUEST_URI} !^/cgi-bin/awstats
# existing rule from Question
RewriteRule ^/(.*)  https://localhost:8443/++vh++https:%{SERVER_NAME}:443/++/$1 [P,L]