Support » Fixing WordPress » Changed site address without moving wp files, but can't access wp-admin now

  • m t

    (@maureenton)



    I have everything working EXCEPT access to the wp-admin panel. I get a 500 Internal Server Error.

    These were my steps:
    1. In the WP settings I updated the site url address to the root: http://www.domain.com
    The site files however are staying in the subdirectory: http://www.domain.com/directory
    I followed these instructions

    2. I Copied the .htaccess and index.php file over to the root directory as those instructions said. I still had to finagle the .htaccess file to get it to work:

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

    3. I manually added this code to the wp-config.php file:

    define('WP_SITEURL','http://www.domain.com/directory');
    define('WP_HOME','http://www.domain.com');

    4. I logged into the hosting control panel’s phpMyAdmin and took a look at the options tables. The site url there had not updated so I manually updated it. Here’s what it is:
    1 siteurl http://www.domain.com/directory
    2 home http://www.domain.com

    At this point, I had gotten everything to work
    http://www.domain.com loads the wp site fine even though the files are sitting in http://www.domain.com/directory while still showing the root url
    – the interior site pages all load fine, and show as permalinks from the root url (the /directory/ disappears if you try to add it to the url)

    The problem is that the wp-admin urls give a 505 Internal Server error and I don’t know what else to try.
    Neither of these work:
    http://www.domain.com/wp-admin (this one on the other hand, automatically adds the /directory/ no matter what)
    http://www.domain.com/directory/wp-admin

    It seems the .htaccess rewriting rule is/isn’t applying just for wp-admin ?

    TIA!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator t-p

    (@t-p)

    If you know how to access phpMyAdmin on your host, then check the wp_options Table (Note: The table prefix of wp_ may be different if you changed it when installing), and make sure siteurl field and home field are correct. See https://codex.wordpress.org/Changing_The_Site_URL#Changing_the_URL_directly_in_the_database

    m t

    (@maureenton)

    I did modify those fields in step 4, and tried 3 other combinations; this is the setting that actually gets the site itself to load properly.

    1 siteurl http://www.domain.com/directory
    2 home http://www.domain.com

    Another clue/bug I just saw in the live site is that the images being accessed from a gallery plugin is not working either- it won’t load images from http://www.domain.com/DIRECTORY/wp-content/uploads/ HOWEVER, other images throughout the site are showing up fine and are in the same directory.

    The admin will always be in the actual directory that WordPress is in. wp-admin doesn’t rewrite any URLs.

    The issue with the gallery seems specific to the plugin. It could be using the wrong functions to get the image URL.

    m t

    (@maureenton)

    The url(s) to get to the wp-admin are just not working.

    Something (maybe the rewrite rules) seem to be interfering with accessing the install directory. If I try to add the /directory/ into any of the page urls, it takes it out which is good – that’s what it should be doing.

    Only when I try to go to the wp-admin, does it automatically put the /directory/ into the url – which is fine, I understand that since that’s where the install is, but I get a 500 internal server error. The wp-admin is just not showing up.

    I’ve never had a need to use a RewriteBase. Try removing that by commenting it out with a hash (#)

    In index.php on the root did you do this:
    require('./wp/wp-blog-header.php');

    Your new login should be:
    http://www.site.com/wp/wp-login.php

    m t

    (@maureenton)

    Yes, I tried renaming the .htaccess file in both the root and /wp/ folders.

    The index.php has that correct.

    That new login is what does not work.

    The .htaccess and index.php files in the /wp folder should be not be modified. The .htaccess should look like this:

    # 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]
    </IfModule>
    
    # END WordPress

    The index.php should look like this:

    define('WP_USE_THEMES', true);
    
    /** Loads the WordPress Environment and Template */
    require( dirname( __FILE__ ) . '/wp-blog-header.php' );

    In your Dashboard, Settings | General it should look like this:

    WordPress Address (URL): http://sitename.com/wp
    Site Address (URL): http://sitename.com

    I’ve never had a need for setting these. Where in the instructions link you mentioned above, did you see this? Its not in there. You got these from where?

    define('WP_SITEURL','http://www.site.com/directory');
    define('WP_HOME','http://www.site.com');
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Changed site address without moving wp files, but can't access wp-admin now’ is closed to new replies.