0

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.com/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.com/wordpress urls, so why in this one case is it trying to redirect to 192.168.122.172?

migrated from superuser.com Jul 3 at 16:07

This question came from our site for computer enthusiasts and power users.

0

I 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.

0

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.com/questions/1457357/how-to-fix-wordpress-links-not-pointing-to-site-url-when-being-accessed-through/1457561

  • I'm not using Traefik, I'm using apache + a libvirt virtual machine. – MarkHammons Jul 9 at 9:09
  • I'm sorry. Your problem is so similar to mine that I imagined you were also using Traefik. Anyway, I believe the proper solution to your issue involves managing to get proper headers reaching Wordpress so it can properly deal with internal redirection as your solution is basically disabling internal Wordpress redirection. Which tool is responsable for directing HTTP(S) requests to the VM Wordpress in your setup? – Rsevero Jul 9 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.