PDA

View Full Version : HELP!! Wordpress - site was inadvertantly redirected



Patrysha
01-14-2011, 04:26 PM
A client was messing around in her Wordpress and changed the address to another domain that she just bought. So now the whole thing is forwarding to the new domain so she can't access the old one. Which is where all her files are. How do we fix this? Is there a way to get in through the cpanel or ftp to change whatever she did manually so that we can bring back the login page.

vangogh
01-14-2011, 10:54 PM
Sorry I didn't see this earlier. I've done this myself by accident. The quickie way to get things working is to add this code to the w-config.php file in the root folder where WordPress was installed. You can add it right at the bottom as long as it's inside the closing php tag (?>)


define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');


That hard codes both the site and home urls you usually see on the general setting page. Adding them to wp-config.php will override what's in the settings and get the blog working again.

It's not an ideal solution as you now won't be able to edit the fields on the settings page, but at least you'll have the right urls. If only one was changed you only need to add that one line of code.

However there are better methods described here in the Changing the Site URL (http://codex.wordpress.org/Changing_The_Site_URL) page from the WordPress documentation.

And trust me this isn't the first time this has happened. I've accidentally changed the site url myself a few times.

Harold Mansfield
01-14-2011, 11:02 PM
I've heard of people doing this and I don't get it. How do you log into the admin panel, go to the settings, and change the URL by mistake?
I'm just asking.

Patrysha
01-15-2011, 12:47 AM
I have no idea how it was done, or really why. Some people like to play with things before calling on me, but I was sure it must've been done before...even if not by me. I figured the answer couldn't be too complicated. Thanks...I'll fix it soonish. I have some other things that need to get done first...

vangogh
01-16-2011, 02:39 AM
Harold it happens. I think the first time I did it I was trying to set up WordPress to be installed in a subfolder and have the home page appear at the root. This was before that was built in as a setting. I meant to change home and changed siteurl (or the other way around) by mistake. Next thing I was locked out of WordPress and had to do some research to get back in.

I don't think people realize what's going to happen when they change either of those two settings. Some people might be experimenting or think something will happen other than what does. There should probably be strong warning not to change them unless you know what you're doing.