• Resolved tonybemidji

    (@tonybemidji)


    Brief synopsis. We have a legacy site… https://www.bemidji.k12.mn.us and are in the process of building a new site in WordPress (Multi-user with directories, not subdomains… ie, Central elementary is https://wptemp.bemidji.k12.mn.us/central/). We are building the site in the root of www in the WordPress directory. The URL to this install is https://wptemp.bemidji.k12.mn.us and the site was obviously based upon that URL.

    So now that we have things built, we want to simply change the domain of the WordPress install to https://www.bemidji.k12.mn.us. My intention is to simply change the directory of the virtual host “www” to look in the “wordpress” directory (so I won’t be moving anything) and then make the appropriate changes to the WordPress config files to effect the entire change.

    So we are not moving any files… simply changing the site(s) from “wptemp” to “www”.

    I was making changes according to the codex instructions, but ended up with some odd problems… Unable to connect to database errors, problems with the URLs not appearing as “www”, etc.

    I’ve restored the database back to the starting point and am going to try to run through it again. This seems like it should be a pretty straightforward change, but I’m guessing my problem is that there are changes in the database that I am missing.

    I changed wp-config to reflect the new domain name.
    In the database I changed “wptemp.bemidji.k12.mn.us” references to “www.bemidji.k12.mn.us” in the following tables/columns:

    wp_options: site_url, home
    wp_blogs: domain for the site
    wp_site: domain
    wp_sitemeta: siteurl

    .htaccess (in the wordpress directory) looks like this:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ – [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    Where else should I be making changes/what have I left out here?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Thread Starter tonybemidji

    (@tonybemidji)

    OK… I’m still puzzled.

    I’ve gotten beyond database errors, that was a stupid mistake on my part.

    again… no files moving… just changing from “wptemp” to “www” in the domain.

    I have done the following:

    Change wp-config… define(‘DOMAIN_CURRENT_SITE’, ‘www.bemidji.k12.mn.us’);

    Then, in the database I changed all instances of “wptemp.bemidji.k12.mn.us” to “www.bemidji.k12.mn.us” in the following:

    wp_options: site_url, home
    wp_blogs: domain for the site
    wp_site: domain
    wp_sitemeta: siteurl

    So I can get to the admin dashboard now using “www.bemidji.k12.mn.us/wp-admin” and the home page shows up correctly at www, but now if I click on any link to get to a page I get a 404 error. The instructions say not to mess with GUID data and that is the only place I see the old URL in the wp_posts table.

    I have also changed the corresponding data for each sub-site and now when I try to go to “www.bemidji.k12.mn.us/central/” I just get bumped back to the main home page.

    What am I missing?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    but now if I click on any link to get to a page I get a 404 error

    Simple test: Hover OVER the link. Is it the right URL?

    You need to edit the wp_x_posts table, by the way (where x is the site number for whatever site you’re working on)

    Thread Starter tonybemidji

    (@tonybemidji)

    Thanks Mike…

    I changed everything back for now, but here is basically what I observed:

    I have a page right now called Administration. The URL: https://wptemp.bemidji.k12.mn.us/district/administration/ works. When I make the above changes, going to https://www.bemidji.k12.mn.us gets me to the home page just fine. But if I hit the link to Administration it goes to https://www.bemidji.k12.mn.us/district/administration/ and gives me the 404.

    This is the root blog, so looking at wp_posts I see an entry for Administration but the only place I see a reference to the old “wptemp” is in the GUID field… which is supposedly not to be touched.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Since you changed everything back, I can’t know for sure.

    My GUESS is you didn’t change the links in the menu.

    Thread Starter tonybemidji

    (@tonybemidji)

    I’ll make the base changes again and double-check.

    Is there something specific that I should be looking for in the wp_x_posts tables? I’m not seeing anything other than the GUID field that contains a reference to the old domain name.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    You have to look in the right tables ??

    wp_posts – Main site. That’s where the menu for the MAIN site would be

    wp_2_posts – Sub site.

    Also make sure you used the right search/replace tool. If you don’t use one that’s serialization safe, it’s a nightmare.

    Finally make sure your THEME didn’t hardcode things in.

    Thread Starter tonybemidji

    (@tonybemidji)

    I think I finally have it. I just created a backup install of my site and replicated the database to test this out.

    My main problem was the .htaccess file. For a new (3.5+) Multi-site/subfolder install it should be:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    Then I used the Search and Replace (2.65) plugin and did a search and replace on just the “content” and “meta” for each site.

    There were a couple of other menu related items that just had to do with caching, but I think for the most part I can replicate this on the live site.

    Thanks for the help!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Changing JUST the Domain Name’ is closed to new replies.