How to Fix Wrong Path to WordPress Site Address, When Error Was Done in Admin Settings?

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.

Share:
This entry was posted in WordPress and tagged . Bookmark the permalink.

34 Responses to How to Fix Wrong Path to WordPress Site Address, When Error Was Done in Admin Settings?

  1. Marcelle says:

    haha…. this is a cool idea! ๐Ÿ™

  2. Thank You so much. that worked ๐Ÿ™‚

  3. dammuozz says:

    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 ๐Ÿ˜€

  4. Rooie says:

    Life Saver.

  5. jordan says:

    Thank you. Quick and easy solution. Saved me an hour at least.

  6. mary jane says:

    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.

  7. shubham says:

    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!!!!

  8. mickie says:

    you save my butt, pal :))

    Thanks alot

  9. zacfoo says:

    thanks SOO much. You saved my butt at the end of a long hard day transferring site files to a new host. THANK YOU!!!

  10. Mark Gason says:

    Thanks!!
    Just totally saved my bacon on a client site. Awesomely valuable tip. You should have a donate button on this post ๐Ÿ˜‰

  11. 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!!

  12. David Mitchell says:

    Thank you. Worked perfectly. I feel like a cool whiz bang programmer now, even though I’m not! ๐Ÿ™‚

  13. gem says:

    Thanks so much! your tip worked!

  14. You are a GOD!!! Thank you so much!

  15. T666 says:

    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

  16. Chris says:

    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!

  17. Zub says:

    THANK YOU! I could digitally kiss you for this.

  18. rafa says:

    Thank you very much!!!!!!! it worked!!!!!!!

  19. shannon says:

    AWESOME!!! Thank You!

  20. Catherine says:

    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.

  21. Judy says:

    Thank you, you saved me big-time!

  22. Your idea helped me to resolve my problem.
    Thank you very much.

  23. I says:

    Live saver! Thank you so much!

  24. Fahmi says:

    Thank you!

  25. i486you says:

    Thank you soooooo much~~~~~~~~!!! ^ ^

  26. shamoon14 says:

    Well, you can use Long Path Tool for such problems, it works good.

  27. Kenny says:

    Thank you so much! That totally saved me.

  28. Jaap says:

    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!

  29. rk says:

    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

  30. Michael Workman says:

    You are the man! Worked great!

Leave a Reply

Your email address will not be published. Required fields are marked *