Dumb Munin
Dumb Munin

Reputation: 21

Resetting WP_HOME?

I'm trying to enable my wordpress to the local network, and since XAMPP's listen, my firewall enabling ports, and wordpress changing address through the dashboard didn't work, I tried a couple of things people kept saying it worked wonders.

I went to wp-config.php and set the constants of WP_SITEURL and WP_HOME, I knew the dashboard would be ignored due to hardcoding, but I wasn't expecting at all that even after removing the two lines of code from the file, they would still be valid.

So yeah, now my wordpress is unable to redirect to homepage and so far I didn't find a way to reset the hardcoding I did. Is there a solution to this?

Edit:

I found it really weird that regardless of what IP was on WP_SITEURL or WP_HOME, the dashboard would let me set up the address there and save it (either it being localhost or not). I decided to try some incorrect IPs to see if anything would happen and the website crashed (as expected), reusing the correct IP or imputing "localhost" on wp-config brought the site back on without letting me change the dashboard (normal behaviour for once, I guess).

However removing the lines of code makes the website crash.

And the home page is never redirected like it was before the code either way. And yes, updating which page should be homedoesn't work =/

Upvotes: 1

Views: 1522

Answers (3)

Orfanosmoto
Orfanosmoto

Reputation: 1

define('WP_HOME', '[original value]'); define('WP_SITEURL', '[original value]');

define('RELOCATE',true);

Upvotes: -1

Dumb Munin
Dumb Munin

Reputation: 21

Okay so, to sum up: I got tired of anything using "define" on wp-config not working (even exactly the same code), and went to phpMyAdmin and found out that even though the address would change on the dashboard, the database would still hold a previous value.

The solution was to just change the value directly on the database's wp_options. Still, it didn't change until I cleaned my cache completely, nice to know you have my back, Firefox. The downside is that just like hardcoding in php, it doesn't let you change on the dashboard. But honestly, it is redirecting again as it should so I don't care.

Regardless, thank you all for the help and patience, and if you're here because you also had this problem, good luck.

Upvotes: 1

Tyler Peckenpaugh PhD
Tyler Peckenpaugh PhD

Reputation: 373

The reason the settings persisted is because WordPress saved them to the database. Using define ('WP_HOME', 'localhost') in wp-config.php is just a shortcut for updating an option in the database.

To change it back, you'll need to repeat the same process, but with the original values.

That is, add the following to your wp-config.php

define('WP_HOME', '[original value]');
define('WP_SITEURL', '[original value]');

As for your original issue, it might be that you don't have Apache configured correctly, or that file permissions are not appropriately set. If WordPress isn't able to create or modify .htaccess you can run into these kinds of issues.

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

Upvotes: 1

Related Questions