最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin0浏览0评论

I need to setup bedrock wordpress boilerplate 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
/path/to/blog.domain/wp

Document root in Nginx
root /path/to/blog.dmain/wp/web;

Physical directory (blog) under web
/path/to/blog.dmain/wp/web/blog;

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_HOME=
WP_SITEURL=/

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 (www.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,

Regards, Srini

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

Main Domain
https://www.domain/

Blog URL
https://www.domain/blog/ -> Reverse Proxy to the below WP installation

Reverse proxy setup in apache server.
ProxyPass /blog/ https://blog.domain/blog/
ProxyPassReverse /blog/ https://blog.domain/blog/

Wordpress Installation (Bedrock)
https://blog.domain/blog/

Wordpress Project Root
/path/to/blog.domain/wp

Document root in Nginx
root /path/to/blog.dmain/wp/web;

Physical directory (blog) under web
/path/to/blog.dmain/wp/web/blog;

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_HOME=https://blog.domain/blog
WP_SITEURL=https://blog.domain/blog/wp/

wp_options table
siteurl ->  https://blog.domain/blog/wp
home -> https://blog.domain/blog/wp

With the above setup, the below URLs work fine. https://www.domain/blog/

Blog homepage works fine and loads all the theme assets from https://blog.domain/blog/

https://www.domain/blog/wp-json/wp/v2/posts REST API works fine

https://blog.domain/blog/wp/wp-admin/ 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 (www.domain)

https://www.domain/blog/page-x -> https://www.domain/blogpage-x

https://www.domain/blog/hello-world -> https://www.domain/bloghello-world

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,

Regards, Srini

Share Improve this question asked May 27, 2020 at 19:35 SriniSrini 1
Add a comment  | 

1 Answer 1

Reset to default 0

By disabling canonical redirection, the issue solved

remove_action('template_redirect', 'redirect_canonical');

Thanks to Mahesh Waghmare.

https://maheshwaghmare/avoid-wordpress-canonical-redirection/

发布评论

评论列表(0)

  1. 暂无评论