使用Apache 2.2上的mod_rewrite重定向http tp https

问题描述 投票:0回答:1

我在8080上有一个正常的mywebsite.com托管端口。我能够使用mod_rewrite将端口从8080重定向到开放端口80。现在,我有一个新要求,将特定的http重定向到https(ssl)端口。我已经尝试过很多方法,但仍然无法抛出禁止访问错误403。

仅供参考,我尚未使用.htaccess进行此访问,因为mywebsite.com由第三方拥有,他们拒绝为我提供应用程序的路径目录。

Apache:2.2

操作系统:Windows Server 2016

<VirtualHost *:80>

RewriteEngine On

RewriteRule ^/(.*) http://mywebsite.com:8080/VirtualHostBase/http/%{SERVER_NAME}:80/mywebsitedoc/VirtualHostRoot/$1 [L,P]

</VirtualHost>

Listen 443

<VirtualHost *:443>

ServerName mywebsite.com

SSLEngine on

SSLCertificateFile "C:/Apache2.2/conf/mywebsite.com.crt"

SSLCertificateKeyFile "C:/Apache2.2/conf/mywebsite.com.key"

SSLCertificateChainFile "C:/Apache2.2/conf/mywebsite.com.gd_bundle-g2-g1.crt"

</VirtualHost>

http ssl mod-rewrite https apache2.2
1个回答
0
投票

我有如下答案。仅供参考,这是运行在端口8080的zope Web服务器,我需要将所有80个请求转发到端口8080

<VirtualHost *:80>

ServerName mywebsite.com

Redirect permanent / https://mywebsite.com:443/

</VirtualHost>

Listen 443

<VirtualHost *:443>

ServerName mywebsite.com

SSLEngine on

SSLProxyEngine on

RewriteEngine On

RewriteRule ^/(.*) http://mywebsite.com:8080/VirtualHostBase/https/%{SERVER_NAME}:443/staffportal/VirtualHostRoot/$1 [L,P]

SSLCertificateFile "..."

SSLCertificateKeyFile "....."

SSLCertificateChainFile "....."

</VirtualHost>

关于,AA

© www.soinside.com 2019 - 2024. All rights reserved.