【问题标题】:Apache rewrite module https to https with different port not workingApache 将模块 https 重写为不同端口的 https 不起作用
【发布时间】:2020-04-15 15:20:55
【问题描述】:

我正在尝试在 Apache(通过 XAMPP 运行)中重写传入请求的端口,但无论我做什么,它都不起作用。 我想从 -
https://qr-radec-minus.dot/cp.tms.fe/services/M0780UPPQueryPort?wsdl
重定向所有这样的传入请求 到
https://qr-radec-minus.dot:16262/cp.tms.fe/services/M0780UPPQueryPort?wsdl

以下是我尝试过的不同的重写模块规则 -

RewriteRule ^/(?!qr-radec-minus\.dot)(.*) https://qr-radec-minus.dot:16262$1

#RewriteCond %{HTTP_HOST} ^qr-radec-minus\.dot$ [NC]        
#RewriteRule ^(.*)$ https://qr-radec-minus.dot:16262$1 [R=301]

#RewriteCond %{HTTP_HOST} ^qr-radec-minus\.dot:443$ [NC]
#RewriteCond %{SERVER_PORT} ^443$
#RewriteRule ^(.*)$ https://qr-radec-minus.dot:16262/$1 [L,R=302]

#RewriteCond %{SERVER_PORT} !^16262$
#RewriteRule ^(.*)cp\.tms\.fe/?$ https://%{HTTP_HOST}:16262/$1 [R=301,L]
#RewriteRule ^/(?!qr-radec-minus)(.*) https://qr-radec-minus.dot:16262/$1 [R,L]

提前谢谢!

【问题讨论】:

  • 你把这些指令放在哪里?您还有哪些其他指令? “不起作用”到底是什么意思?你有错误吗?格式错误的重定向?什么都没有?

标签: apache mod-rewrite url-rewriting port apache2.4


【解决方案1】:

你可以试试下面的,事先清除缓存。我没有使用任何匹配的组我将传入的 request_uri 与新的端口转发 url 对齐。

RewriteEngine On
RewriteRule ^ https://qr-radec-minus.dot:16262%{REQUEST_URI} [R=301,L]

它正在工作here

【讨论】:

    猜你喜欢
    • 2012-06-07
    • 2016-03-17
    • 1970-01-01
    • 2013-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-19
    相关资源
    最近更新 更多