I recently handed off a WordPress site I developed to an IT team that is in charge of my client's web environment. They aren't WordPress people and I don't have any access to the environment. There are currently issues as a result of the environment they are using, which I'll explain:
- Server A (Web server)
- Domain name (http://example.com) points here, rewrites are made, and traffic is routed to either Server B or C.
- Server B (App server)
- Running an ecommerce CMS. Traffic to http://example.com/shop is routed here
- Server C (WordPress server)
- Running the WordPress site. Traffic to http://example.com/blog is routed here
Next, some important notes:
- The WordPress Address and Site Address in WP are set to http://example.com/blog.
- The WordPress database has been searched and replaced so all URLs are http://example.com/blog
- Pages and assets in the frontend are being served correctly
Despite these facts, there are links in the backend of WordPress that are still using the server's IP address URL. For example, all of the pagination controls in post/page lists.
Also, any kind of form in the backend is broken. For example, if I try to delete a plugin, the form which handles the delete button have the
POST action mapped to
/wp-admin/plugins.php?action=delete-selected... This of course means it's ignoring the
/blog/ subdirectory in the Site Address, which then 404s. I think this particular issue is a result of Server A trying to rewrite that request.
There are other problems, but they all boil down to WordPress seemingly not knowing exactly what its URL is. My opinion is that because of Server C's setup, it is causing the wrong URL to be used in places where the PHP is doing things like this:
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
HTTP_HOST uses the Host header, if one is present, otherwise it must grab the value from the server, which is currently the IP address.
My question is... how do we tweak this setup and fix these URL issues in WordPress?