I wanted to use the site URL change in the general settings page of the admin panel to remove the trailing /wp from my privately hosted wordpress site. After submitting these changes, I am locked out by errors every time I attempt to log in--from a log-in page where the CSS is gone. I have attempted to update the config.php file with


But this did nothing. The Relocation function also did nothing, and I have no functions.php file. According to the codex, that leaves me only with editing the database directly. How can I undo the damage and achieve my desired result of landing on my wordpress site with just example.com instead of example.com/wp?

  • Have you moved WordPress files from /wp directoy to root folder? It is possible to have the site accesible through http://example.com while the WordPress files are in http://example.com/wp, but a little (very little) more work is needed. Have you moved the files?
    – cybmeta
    Feb 5, 2016 at 7:15
  • I tried that as well, it resulted in the same errors.
    – user242007
    Feb 5, 2016 at 16:44
  • I think you didn't understand what I mean Also, things like "Relocation function" or "I have no functions.php file", make me think that you are very confused, not sure if we can help you in the format of this site. To be honest, I think you may need someone to do it for you.
    – cybmeta
    Feb 6, 2016 at 8:39
  • When you say errors, can you give an example?
    – Tom J Nowell
    Oct 17, 2018 at 1:30
  • I have encountered greate problem with wordpress. that is , when I want to host from localhost to live server , i couldn't change the URL to my desire url. please help me
    – geletu
    Sep 8, 2023 at 11:41

5 Answers 5


Best way

If you have access to the site via FTP, then this method will help you quickly get a site back up and running, if you changed those values incorrectly.

  1. FTP to the site, and get a copy of the active theme's functions.php file. You're going to edit it in a simple text editor and upload it back to the site.

  2. Add these two lines to the file, immediately after the initial <?php line:

update_option('siteurl', 'http://example.com');
update_option('home', 'http://example.com');

Use your own URL instead of example.com, obviously.

  1. Upload the file back to your site, in the same location. FileZilla offers a handy "edit file" function to do all of the above rapidly; if you can use that, do so.

  2. Load the login or admin page a couple of times. The site should come back up. Important! Do not leave those lines in the functions.php file. Remove them after the site is up and running again.

Note: If your theme doesn't have a functions.php file create a new one with a text editor. Add the php tags and the two lines using your own URL instead of example.com:.


Upload that to your theme directory. Remove the lines or the remove the file after the site is up and running again.

Source: WordPress.org - Changing The Site URL


Follow the steps below:

  1. Move your file to new folder
  2. Go to your phpmyadmin desire database
  3. Find wp-option change the site url only here to your desire url
  4. Then login to back-end go to general and change both url here to new url
  5. Hit save

It will work perfectly if you want to move WordPress into new location.


Have you checked this one? If no just check this post. Hope this will help you to solve your problem http://codex.wordpress.org/Changing_The_Site_URL

  • This is the codex post I've referenced as trying the suggested solutions from. None have helped.
    – user242007
    Feb 5, 2016 at 4:12

The best way to move an WordPress website to another URL is by exporting, replacing and importing the database. Try doing this by using PHPMyAdmin or another database management tool. For phpmyadmin just select your database and click on export.

After downloading the export of your database, open it in a simple texteditor (Notepad++, Textwrangler) and fire up the search and replace screen. Replace //example.com/wp with //example.com.

Just to be sure, search the file again for //example.com/wp, no results should be found. Then save the file.

Now open up phpmyadmin again, and create another export as an backup. Then delete all tables, and import your replaced SQL file. Now your database should be updated, and the rules in wp-config.php are not needed anymore.

Your site should be working on the other domain now.

Don't forget to re-save your permalinks afterwards.


Check you .htaccess file

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

You can always delete your .htaccess and then once logged back in go to permalink and change it from what you have to another option save page then select your desired permalink and save again this should force wordpress to recreate .htaccess

Not the answer you're looking for? Browse other questions tagged or ask your own question.