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

google-cloud-platformPHPWordpress

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

enter image description here

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

Best Answer

You can use your WordPress installation front page for the health check. This is the most reliable indicator that the WordPress site is available.