docker - Too many redirects error when change of base url

admin2025-01-08  8

recently I got to manage a Wordpress blog (so I don't know of things made before) and to start doing some edits on it I did a local docker compose as sandbox. When I copied the contents (Wordpress files + mysql db), the website worked well, instead for the links that didn't redirect to the local version but to the production one. So, to make them work (as I am unable to access to administration), I replaced in wp_options table site_url and home values with the local path (http://192.168.99.100:33080). However, since I did it, the website no longer loads and finishes into a too many redirects error. Does anyone know how to fix this?

I tried also, instead of add the changes in db, to write them in the wp-config.php file (according to this) but nothing changes.

I am using Wordpress 4.9.8 in HTTP on port 33080 and the container's dockerfile is:

FROM php:5.6.35-apache-jessie

RUN docker-php-ext-install mbstring mysqli pdo pdo_mysql
RUN a2enmod rewrite
RUN echo 'log_errors = On\nerror_log = /dev/stderr' >> /usr/local/etc/php/php.ini

I am very new to Wordpress environment, so assume that if there is something I had to do and I didn't wrote it there, I didn't do it. Thanks.

UPDATE:

I found what's wrong. Despite what written there it seems that the Wordpress I have installed doesn't like port numbers different from 80. In fact, I tried changing my docker-compose port from 33080 to 80 and it started to work fine. In db for siteurl and home I wrote only http://192.168.99.100. I still don't know what to do to make it works with a custom port.

recently I got to manage a Wordpress blog (so I don't know of things made before) and to start doing some edits on it I did a local docker compose as sandbox. When I copied the contents (Wordpress files + mysql db), the website worked well, instead for the links that didn't redirect to the local version but to the production one. So, to make them work (as I am unable to access to administration), I replaced in wp_options table site_url and home values with the local path (http://192.168.99.100:33080). However, since I did it, the website no longer loads and finishes into a too many redirects error. Does anyone know how to fix this?

I tried also, instead of add the changes in db, to write them in the wp-config.php file (according to this) but nothing changes.

I am using Wordpress 4.9.8 in HTTP on port 33080 and the container's dockerfile is:

FROM php:5.6.35-apache-jessie

RUN docker-php-ext-install mbstring mysqli pdo pdo_mysql
RUN a2enmod rewrite
RUN echo 'log_errors = On\nerror_log = /dev/stderr' >> /usr/local/etc/php/php.ini

I am very new to Wordpress environment, so assume that if there is something I had to do and I didn't wrote it there, I didn't do it. Thanks.

UPDATE:

I found what's wrong. Despite what written there it seems that the Wordpress I have installed doesn't like port numbers different from 80. In fact, I tried changing my docker-compose port from 33080 to 80 and it started to work fine. In db for siteurl and home I wrote only http://192.168.99.100. I still don't know what to do to make it works with a custom port.

Share Improve this question edited Aug 10, 2018 at 19:27 Ripper346 asked Aug 10, 2018 at 12:06 Ripper346Ripper346 1011 silver badge2 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Have you tried defining WP_SITEURL and WP_HOME to point to the correct URL? This "overrides" the DB settings.

https://codex.wordpress.org/Editing_wp-config.php#WP_SITEURL

If that doesn't work, the next thing to try is the RELOCATE method

https://codex.wordpress.org/Changing_The_Site_URL#Relocate_method

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736268296a1263.html

最新回复(0)