Changing WordPress Address URL disaster

Fixed by adding a htaccess file to the root directory with this information:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/my_subdir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /my_subdir/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ my_subdir/index.php [L] 
</IfModule>

The main issues was WordPress being installed in a subdirectory, so the root URL was “example.com/subdirectory” instead of “example.com”. This htaccess comfiguration does redirect users properly.

Source: https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory