I have set up wordpress about as well as I can. I have the site url and home configs changed appropriately, and https redirecting is working fine. The only thing that doesn't is links like .php/postname. When wordpress gets a link like this, it's doing a 301 redirect to https://192.168.122.172/wordpress/index.php/postname. This is pointing to an address only accessible to the VM host, so of course the redirect fails and the page content cannot be displayed at all.
Why is this occurring? Everywhere else, wordpress is using the appropriate urls, so why in this one case is it trying to redirect to 192.168.122.172?
I have set up wordpress about as well as I can. I have the site url and home configs changed appropriately, and https redirecting is working fine. The only thing that doesn't is links like https://example/wordpress/index.php/postname. When wordpress gets a link like this, it's doing a 301 redirect to https://192.168.122.172/wordpress/index.php/postname. This is pointing to an address only accessible to the VM host, so of course the redirect fails and the page content cannot be displayed at all.
Why is this occurring? Everywhere else, wordpress is using the appropriate https://example/wordpress urls, so why in this one case is it trying to redirect to 192.168.122.172?
Share Improve this question edited Jul 4, 2019 at 1:01 MarkHammons asked Jul 3, 2019 at 15:17 MarkHammonsMarkHammons 12 Answers
Reset to default 0I found the solution to this. Apparently going to wp-includes/canonical.php
and changing the line $redirect_url = apply_filters('redirect_canonical', $redirect_url, $requested_url);
to $redirect_url = null;
fixes this behavior, though it's a unstable fix since it'll be overwritten by updates.
Why is this so hard to get working? Every other webserver software I've used has not had a problem with virtual machines behind reverse proxies.
I believe the proper solution is to add passHostHeader = true to your Traefik's frontend config as you can see in details in https://superuser/questions/1457357/how-to-fix-wordpress-links-not-pointing-to-site-url-when-being-accessed-through/1457561
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745336813a4623142.html
评论列表(0条)