wordpress-docker-compose icon indicating copy to clipboard operation
wordpress-docker-compose copied to clipboard

WordPress Redirects to IP Address Instead of Domain

Open ErminMerdanovic opened this issue 2 years ago • 5 comments

Hello everyone, I'm currently in the process of setting up WordPress using Docker Compose and Apache which is running on the host as a reverse proxy (unfortunately, I can't use nginx). Additionally, I use Cloudflare. When I attempt to access the site using the domain, I encounter an immediate redirect to "https://127.0.0.1:8585/wp-admin/install.php" instead of the desired "https://domain.com/wp-admin/install.php". To address this, I modified the configuration by adding the following two lines:

define('WP_HOME','https://domain.com');
define('WP_SITEURL','https://domain.com');

This adjustment successfully resolves the issue, but I'm uncertain whether this is the optimal approach. I would greatly appreciate any assistance or guidance on whether this method is appropriate, or if there's an alternative solution that can be implemented through Docker Compose environment variables. Thank you for your insights.

Edit: Unfortunately, when attempting to proceed with the above settings, I encountered again an issue. After completing the WordPress setup and attempting to access the main page of the WordPress site using the domain, I was redirected again to the IP address "https://127.0.0.1/". Is there anyone who has a solution for this problem?

ErminMerdanovic avatar Aug 18 '23 20:08 ErminMerdanovic

Did you try to change the env file there is ${IP} defined so you simply change it to Domain name etc.

mughalmuneeb786 avatar Oct 24 '23 18:10 mughalmuneeb786

Same

kczereczon avatar Feb 19 '24 20:02 kczereczon

Please try some of the solutions mentioned here.

Have you tried disabling some of the plugins, especially those that are related to caching?

nezhar avatar Feb 20 '24 21:02 nezhar

Hello, It might be problem with Nginx / Firewall config problem not with Wordpress by itself.

kczereczon avatar Feb 21 '24 06:02 kczereczon

Yes it was problem with Nginx it occurred when force ssl has been enabled.

kczereczon avatar Mar 02 '24 09:03 kczereczon