Forums

[resolved] Moving from subfolder to subdomain installation (5 posts)

  1. danhgilmore
    Member
    Posted 1 year ago #

    I'm having a hard time converting a WordPress Mu 2.8.6 installation from subfolder to subdomain.

    Current:

    URL for the main blog: http://www.domain.tld/blogs/

    URL for the rest of the blogs: http://www.domain.tld/blogs/username/

    What I want it to be:

    URL for the main blog: http://blogs.domain.tld/

    URL for the rest of the blogs: http://blogs.domain.tld/username/

    Steps I've taken so far:

    1. Changed BASE in .htaccess and wp-config.php to equal "/"
    2. Ran the following SQL queries:

    UPDATE wp_blogs SET domain = 'blogs.domain.tld';
    UPDATE wp_blogs SET path = (SELECT SUBSTR(path, 7));   (This removed '/blogs/' from every path entry)
    UPDATE wp_site SET domain = 'blogs.domain.tld';
    UPDATE wp_site SET path = '/';
    UPDATE wp_site_posts SET post_permalink = REPLACE(post_permalink, 'http://www.', 'http://blogs.');
    UPDATE wp_site_posts SET post_permalink = REPLACE(post_permalink, '/blogs/', '/');

    3. I have a script that hits every wp_X_options table and changes the siteurl, home, and fileuploads values to reflect the new URL. I've verified that the values are in the database correctly.

    4. Re-saved the permalink options

    5. Deactivated all plugins.

    Results:

    1. The main blog page comes up just fine at http://blogs.domain.tld/ as does the admin page for the main blog.

    2. When I click on a link for a blog (not a specific blog post), I get redirected to the main blog page. Nothing in error log. Access log shows a 200.

    3. When I click on a link for a specific blog post, I receive "Sorry, no posts matched your criteria".

    .htaccess file:

    RewriteEngine On
    RewriteBase /
    
    #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteCond %{REQUEST_URI} ^.*/wp-admin$
    RewriteRule ^(.+)$ /$1/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule  ^([_0-9a-zA-Z-\.]+/)?(wp-.*) $2 [L]
    RewriteRule  ^([_0-9a-zA-Z-\.]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    
    <IfModule mod_security.c>
    <Files async-upload.php>
      SecFilterEngine Off
      SecFilterScanPOST Off
    </Files>
    </IfModule>
    
    # END WordPress

    If anyone has any ideas on this, I'd be most appreciative.

  2. danhgilmore
    Member
    Posted 1 year ago #

    It seems that this is most likely a .htaccess problem, but I'm reeeeeaaaally inexperienced with regex and redirects.

    Also when I go to any blog via http://blogs.domain.tld/username/, it seems that the_loop doesn't find any posts, but I assure you the blog has posts.

  3. Did WPMU have a different .htaccess for subdomains and subfolders?

    Also, what was your OLD .htaccess set to?

  4. danhgilmore
    Member
    Posted 1 year ago #

    @Ipstenu - the old .htaccess is identical to what's posted up there, except that RewriteBase was set to /blogs/.

    Also, I think I've been going about it all wrong. I can't have a static subdomain with a subfolder as the username. The subdomain has to be the username.

    This is what I wanted but won't work:
    http://blogs.domain.com/USERNAME1
    http://blogs.domain.com/USERNAME2
    http://blogs.domain.com/USERNAME3

    but this is what it has to be:
    http://USERNAME1.domain.com/
    http://USERNAME2.domain.com/
    http://USERNAME3.domain.com/

    That's going to cause major issues because our usernames have periods in them :(

  5. Right,you had me confused earlier on too, because installed in a subdomain is not the same as subdomaing blogs.

    blog.domain.com/username/ is a *subfolder* install. because your usernames are subfolders.

    That's going to cause major issues because our usernames have periods in them

    The only way I can think of to get around this is is the account it's installed in the default host on the box.

Topic Closed

This topic has been closed to new replies.

About this Topic