1

I have a blog on a subdomain (WP installation), which for SEO reasons I’m moving to a folder structure. The subdomain and the main site are on different servers/platforms, so I’m using a reverse proxy.

blog.example.com --> example.com/blog

The challenge I came upon is that when I do updates, they are being blocked by some security features the main site example.com has.

So I'm looking for a solution that will keep the current site at example.com/blog, but I can still access the wp-admin at blog.example.com/wp-admin

I'm using this in the .htaccess:

RewriteRule ^/blog/(.*) "https://blog.example.com/$1" [NC,P]
RewriteCond %{HTTP:X-Proxy} !^example$ [NC]
RewriteCond %{REMOTE_HOST} !^IP#
RewriteCond %{HTTP:X-Forwarded-Host} !example.com$
RewriteCond %{HTTP_HOST} ^blog\.example\.com$ [NC]
RewriteRule (.*) https://www.example.com/blog/$1 [R=301,L]

In the settings, both WP-HOME and SiteURL are set to example.com/blog, so I get redirected to example.com/blog/wp-admin each time I try to access blog.example.com/wp-admin

Any ideas how to make this work?

0

You must log in to answer this question.

Browse other questions tagged .