Score:0

Serving a wordpress site in a subfolder proxied on different server

be flag

I have a landing page and a wordpress site in a subfolder

example.com -> landing page
example.com/blog -> wordpress

I want to serve the wordpress site on a different server. I created a server( blog.example.com) and moved all files and databases that belong to wordpress. I have changed nginx configuration (example.com) a bit and added those lines below

  location /blog {
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   Host      $http_host;
    proxy_pass https://blog.example.com:443 ;
        }

Now, Any user heading to example.com/blog/posts sees the content on blog.example.com/blog/posts without redirecting to blog.example.com . But after loading the first page (posts) when he clicks any link , he is redirected to blog.example.com, which is not desired action.
I have to set siteurl and home as blog.example.com on blog.example.com. Because If I set siteurl and home as example.com/blog, it redirects to example.com when the first page is loaded . So how can I serve a wordpress site in a subfolder proxied on different server?

Ryszard Kozłowski avatar
af flag
Great question! Have same issue with SvelteKit. My site is on svelte, and I would like to have blog in domain on wordpress. Regarding your issue (I have the same not fixed yet), have you tried: 1)Setting URL's in WordPress setting to "example.com" or "example.com/blog" ? (I would try both) 2)Setting links (perma links) as example.com/%posts%/ or example.com/blog/%posts%/ 3)Configuring htaccess file so it will understand the proxy made As mentioned I haven't yet solved it
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.