0

I have a wordpress blog hosted on a server (say server-blog) at, say, https://blog.example.com and our python application hosted on separate server (say server-py), url of which is https://www.example.com. To get SEO juice out of our blog on primary domain, content is proxy passed from https://blog.example.com to https://www.example.com/blog/. The configuration on the of the same is fairly simple.

SSLProxyEngine on
ProxyPass /blog/ https://blog.example.com/
ProxyPassReverse /blog/ https://blog.example.com/

Now, I'd like the https://blog.example.com domain to redirect to https://www.example.com/blog/, so that the end user is not confused as to which one is the correct URL. Since, https://www.example.com/blog/ is already proxy passed, simply adding a redirect rule will create an infinite redirect loop. I've looked into working with query string params, but proxy pass doesn't work with that.

Any ideas as to how this can be done?

1 Answers1

0

Perhaps not ideal, but you could redirect/rewrite all traffic, except when the request comes from the reverse proxy (which I guess will have a static ip, say 1.2.3.4). Alter the vhost for blog.example.com on server-blog and add something like:

RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4$
RewriteRule ^/(.*)$ https://www.example.com/blog/$1 [R,L]

(Not tested)

Frank Vermeulen
  • 157
  • 2
  • 8