Bedrock under a sub-directory and access through a reverse proxy setup


First of all a big thanks to the bedrock team. I use bedrock boilerplage for all my WP projects and no issues so far. This boilerplate solved several of our past issues.

Now, I need to setup bedrock in a sub-directory and get accessed through a reverse proxy setup.
Please see below the setup as per my REQUIREMENTS:

Main Domain

Blog URL -> Reverse Proxy to the below WP installation

Reverse proxy setup in apache server.
ProxyPass /blog/
ProxyPassReverse /blog/

Wordpress Installation (Bedrock)

Wordpress Project Root

Document root in Nginx
root /path/to/;

Physical directory (blog) under web

Created the below symlinks in the above folder (blog)
ln -s …/wp/ wp
ln -s …/app/ app
ln -s …/wp-config.php wp-config.php
ln -s …/index.php index.php

.env file

wp_options table
siteurl ->
home ->

With the above setup, the below URLs work fine.
Blog homepage works fine and loads all the theme assets from
REST API works fine
Able to login in the WP admin and create/edit pages and posts without any issues.

However, other than the blog home page, rest of the pages and posts do not work and getting redirected as shown below, when accessed through the main domain ( -> ->

Note the leading slash of the page-slug/permalink is removed and redirected as /blogpage-x or /bloghello-world and resulting 404 error in the main domain.

I have deactivated yoast seo plugin.

Not sure what I am missing. Should I change any of my bedrock configs?

Please help. Thanks in advance,


By disabling canonical redirection, the issue solved
remove_action(‘template_redirect’, ‘redirect_canonical’);

Thanks to Mahesh Waghmare

This topic was automatically closed after 42 days. New replies are no longer allowed.