You had developed a WordPress site in a folder on your hosting account. Let’s say it was www.yourdomain.com/site/. Then it’s ready to be published and you are changing wordpress address to point to the root domain, to yourdomain.com. You copy your index.php (and .htaccess) to the root, changing path to your /site/ folder. And you changed the path to your site in Admin / Settings, as described in WordPres Codex. But what if you put a wrong address in Admin?
Like instead of modifying Site address (URL) you deleted /site/ from WordPress address (URL). You will not be able to enter admin anymore. You may edit then your database in phpMyAdmin to set back correct pathes, but the easiest way I found to deal with it, is to disable .htaccess files in root and /site/ folders, then to open /site/wp-login.php file in your editor, like notepad. Find on top of the page:
require( dirname(__FILE__) . '/wp-load.php' );
And add following lines to fix the settings:
//FIXME: remove these lines once database updated update_option('siteurl', 'http://www.domain.com/site' ); update_option('home', 'http://www.domain.com/site' );
Go to wp admin login page /site/wp-login.php and reload. You will have your login working back to normal. And you can put back .htaccess and you should delete database fix code from /site/wp-login.php. Then change the correct path in wp admin / settings. WordPress address (URL) is where your wordpress installation is stored and it may look like www.yourdomain.com/site. The second input below, Site address (URL), should be pointed to your site root, Site address (URL) – yourdomain.com. No slashes are needed at the end of URL.
haha…. this is a cool idea! 🙁
Thank You so much. that worked 🙂
Thank you!! It worked for me too…
using the bookmark /site/wp-admin it wasn’t working!
just make sure to login on /site/wp-login.php as you said 😀
Life Saver.
Thank you. Quick and easy solution. Saved me an hour at least.
For a newbie.. who screwed it up. I type the wrong name in the settings and now another site comes up….May I please have a step by step approach please and thank you.
hey ,i changed the settings, where it was saying Site Domain name:
i put a domain name that doesnt exist,and the site is getting redirected to the wrong link which doesnt exist… 🙁 please help me,and i didnt had any files recovered of that server ,as people say….
how to change back again?
i cant even login as admin… 🙁
it says page dont exist,because it redirects to the url that doesnt exist…. 🙁 please help!!!!
you save my butt, pal :))
Thanks alot
thanks SOO much. You saved my butt at the end of a long hard day transferring site files to a new host. THANK YOU!!!
Thanks!!
Just totally saved my bacon on a client site. Awesomely valuable tip. You should have a donate button on this post 😉
AMAZING!!! To be honest, I know very little about coding or any of this brain frying stuff, and I had just messed up the WordPress URL’s on two sites I’m creating by accident (too early in the morning!!) and this little maneuver fixed both of them! Thank you Iggy!!! You saved me so much aggravation! Brilliant!!
Thank you. Worked perfectly. I feel like a cool whiz bang programmer now, even though I’m not! 🙂
Thanks so much! your tip worked!
You are a GOD!!! Thank you so much!
i dont understand why the wordpress admin is at the mercy of things like this
when you type one line wrong and you loose all access to your admin
so u cant even correct it seems so stupid
i like your method tho
ive experienced this the hard way
i ended up having to learn about the sql stuff
and changing the site and home values there
which is easy for me now
but i still dont understand why the admin part of any wordpress site
cant just sit anywhere and never be disturbed
you should always have access to that
by just visiting the url for yur wp-admin
i mean its not like the actual admin has moved anywhere
its all just sitting there
makes me think they deliberately designed it this way
just to screw people over
and make em need to hire some coder to come an fix it
I have the exact problem… AND I am a totally newbie to wordpress… I’ve tried to find the file .htacces but I cant find it anywhere! And yes I have tried view -> show_invisible_items… Anybody? This would be a great help!
try to use filezilla ftp client
THANK YOU! I could digitally kiss you for this.
ha ha 🙂
Thank you very much!!!!!!! it worked!!!!!!!
AWESOME!!! Thank You!
I have two blogs and when I click on the RSS icon it goes directly (in both blogs) to ipodcast for the Spiritual Hologram, which I don’t use, nor have I ever set it up. My RSS use to work and take me to my blogrolls. How can I fix this?
Also when I click on RSS on other WordPress help sites..same thing it takes me to the Spiritual Hologram ipodcast icon. Many sites…except yours, which is why I am writing to you.
Thanks for any feedback.
Hmm, maybe because I use http://feedburner.google.com for feed links.
Thank you, you saved me big-time!
Thank you!!!!
Your idea helped me to resolve my problem.
Thank you very much.
Live saver! Thank you so much!
Thank you!
Thank you soooooo much~~~~~~~~!!! ^ ^
Well, you can use Long Path Tool for such problems, it works good.
Thank you so much! That totally saved me.
WOW!
I have no experience whatsoever, started my first website yesterday, messed it up today, brought it back to life within minutes, thanks to you!
hey ,i changed the settings, where it was saying Site Domain name:
i put a domain name that doesnt exist,and the site is getting redirected to the wrong link which doesnt exist… 🙁 please help me,and i didnt had any files recovered of that server ,as people say….
how to change back again?
i cant even login as admin… 🙁
it says page dont exist,because it redirects to the url that doesnt exist…. 🙁 please help!!!!
Reply
You are the man! Worked great!
Thanks for that great tip, helped me a lot, I was just about to get desperate when I found your article!!!