大网数据广告活动
服务器运维问答

How to create a url in a wordpress that will return code 200?

· 52CE 我爱测

This is needed because I need to implement a load balancer in GCP for a word press instance. GCP will only forward a request to the wordpress instance if it passes the health test. Here is a typical of definition of a health chec…

问题原文

原帖链接 · Anthony Kong · CC BY-SA 3.0

This is needed because I need to implement a load balancer in GCP for a word press instance.

GCP will only forward a request to the wordpress instance if it passes the health test.

Here is a typical of definition of a health check screen

It expects the 'request path' to return 200. Otherwise the target system is considered down.

However if I create a page in wordpress e.g. /index.php/newpage, it will always return 301.

While the wordpress site is up and running, it fails the health check.

Is there any way I can define a page in wordpress that will return 200? Hopefully it will not require additional plugin because I would like avoid maintaining extra plugin.

The last resort to me is to add a url to the php server that will return 200. However the status of this url may not 100% reflect the health of the wordpress site (which may go down due to mysql issue for example). If it is indeed the last resort, what is the best way to implement it? I am not proficient with php developement.

The version of wordpress is 4.6.2

社区高分解答

原帖链接 · Anson Goldade · CC BY-SA 4.0

For what it's worth, I had to set-up a WordPress site in a container and get a health check to succeed before I could even get traffic directed to it. The suggestions for the "front page" work only AFTER WordPress has been installed through the browser. Prior to that they return a 302 status code to /wp-admin/install.php. I noodled around in the container folders and decided on using /wp-includes/images/blank.gif as the health check path. This allowed the health check to succeed and traffic started routing to the container. From there I installed WordPress through the browser and was able to change the health check path back to /.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-01-17)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。