.htaccess 反向代理和htaccess重写规则

.htaccess 反向代理和htaccess重写规则,.htaccess,redirect,reverse-proxy,cloudflare,.htaccess,Redirect,Reverse Proxy,Cloudflare,我需要一些帮助 我们在主网站example.com/blog上创建了一个反向代理,该代理指向子域名blog.example.com(位于不同的服务器上) 主站点正在使用CloudFlare 我尝试过这些重写规则: RewriteCond %{HTTP:X-Forwarded-Host} !^$ RewriteCond %{HTTP_HOST} ^blog\.example\.com$ [NC] RewriteRule (.*) https://www.example.com/blog/$1 [R

我需要一些帮助

我们在主网站example.com/blog上创建了一个反向代理,该代理指向子域名blog.example.com(位于不同的服务器上)

主站点正在使用CloudFlare

我尝试过这些重写规则:

RewriteCond %{HTTP:X-Forwarded-Host} !^$
RewriteCond %{HTTP_HOST} ^blog\.example\.com$ [NC]
RewriteRule (.*) https://www.example.com/blog/$1 [R=301,L]
在上一个示例中,我们的开发人员在标题中添加了一个值为“example”的“X-Proxy”

这些都不起作用

我和我们的主机支持人员谈过了,他们也不明白。他们说CloudFlare似乎确实阻止了这种重定向

HTTP/2 301 
date: Wed, 04 Nov 2020 17:35:39 GMT
content-type: text/html; charset=iso-8859-1
location: https://www.example.com/blog/
cache-control: max-age=0
expires: Wed, 04 Nov 2020 17:35:39 GMT
cf-cache-status: DYNAMIC
cf-request-id: 06245ed2b6c00018e1996976000000001
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
strict-transport-security: max-age=2592000
server: cloudflare
cf-ray: 5ed014bf12305e18-DTW
你知道我能做什么吗

RewriteCond %{HTTP_X_PROXY} "example"
RewriteCond %{HTTP:X-Forwarded-Host} ^$
RewriteCond %{HTTP_HOST} ^blog\.example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.blog\.example\.com$
RewriteRule ^(.*)$ "https\:\/\/example\.com\/blog$1" [R=301,L]
HTTP/2 301 
date: Wed, 04 Nov 2020 17:35:39 GMT
content-type: text/html; charset=iso-8859-1
location: https://www.example.com/blog/
cache-control: max-age=0
expires: Wed, 04 Nov 2020 17:35:39 GMT
cf-cache-status: DYNAMIC
cf-request-id: 06245ed2b6c00018e1996976000000001
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
strict-transport-security: max-age=2592000
server: cloudflare
cf-ray: 5ed014bf12305e18-DTW