• Resolved chaoticconfused

    (@chaoticconfused)


    Hi, I recently moved my site from one server to another. I host my own servers and they are public facing (I want to take the original one down and use it for local network things only). Currently, I have a wordpress site hosted at:

    https://www.chaoticconfused.com

    It is in a multisite, sub-domain configuration. It was migrated from a multisite, sub-directory install. Here are the the other two wordpress sites:

    https://testbed.chaoticconfused.com/
    https://www.chaoticconfused.com/iknowwhymotherseattheiryoung # I have yet to migrate this site to its own sub-domain due the current issue

    There is also a separate site that my girlfriend uses for class/web development:

    https://r3.chaoticconfused.com

    I am running WordPress 4.1 on a LAMP server using Debian Jessie. Here is the code in my config file (Debian separates it from wp-config.php by using a script inside wp-config.php to refer to a separate file) and my htaccess.

    wp-config.php (debian version)

    <?php
    define('DB_NAME', 'wordpress');
    define('DB_USER', 'XXXX');
    define('DB_PASSWORD', 'XXXX');
    define('DB_HOST', 'localhost');
    define('WP_CONTENT_DIR', '/var/lib/wordpress/wp-content');
    
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', true);
    define('DOMAIN_CURRENT_SITE', 'www.chaoticconfused.com');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);
    ?>

    htaccess

    # For rewrite rules needed for making WordPress URL friendly
    # See Options -> Permalinks for details and please use the defaults,
    # especially in mind when hosting several blogs on one machine!
    
    ##
    ## Configuration for a single blog hosted on / (root of the website)
    ##
    #<IfModule mod_rewrite.c>
    #RewriteEngine On
    #RewriteBase /
    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteRule . /index.php [L]
    #</IfModule>
    
    ##
    ## Configuration for a multi-site wordpress installation using subdomains
    ##
    #<IfModule mod_rewrite.c>
    #RewriteEngine On
    #RewriteBase /
    #RewriteRule ^index\.php$ - [L]
    ## uploaded files
    #RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    ## real files dealt directly
    #RewriteCond %{REQUEST_FILENAME} -f [OR]
    #RewriteCond %{REQUEST_FILENAME} -d
    #RewriteRule ^ - [L]
    ## other go through index.php
    #RewriteRule . index.php [L]
    #</IfModule>
    
    # Block the include-only files.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^wp-admin/includes/ - [F,L]
    RewriteRule !^wp-includes/ - [S=3]
    RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
    RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
    RewriteRule ^wp-includes/theme-compat/ - [F,L]
    </IfModule>
    
    <files wp-config.php>
    order allow,deny
    deny from all
    </files>
    
    # End of Block
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    # Multisite Sub-Domain
    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]
    
    # End Multisite Sub-Domain
    </IfModule>
    
    ErrorDocument 403 /index.php?status=403
    
    # END WordPress

    The problem I am having is that the Dashboard links in the Network Admin section point to an incorrect URL. It acts as though it is still in a sub-directory install. I did this using a fresh install of WordPress and then migrating the blogs over to the new server (I did not directly copy and paste all the WordPress files over). Here are a few picture of the error I am describing:

    incorrect url

    full incorrect url when clicked

    Now, I can access the site admin if I change the link that I get when clicking on Dashboard in Network Admin section to https://testbed.chaoticconfused.com/wp-admin/ I can get to the Dashboard. Also, if someone where to click from their own site’s Dashboard link, it will take them to the correct link. I have tried disabling plug-ins, reinstalling, deleting sites and restoring from back-ups, and etc. However, I seem to not be able to fix this little quirk. I will include pastebins of my VirtualHost files from Apache (Apache 2.4.12). Any assistance with this would be greatly appreciated.

    main wp virtualhost

    sub-domain that is not wordpress

Viewing 1 replies (of 1 total)
  • Thread Starter chaoticconfused

    (@chaoticconfused)

    I figure it out. This is the proper configuration for a WordPress Sub-Domain install:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    # Multisite Sub-Domain
    
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^wp-admin$ wp-admin/ [R=301,L]  # was "RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]"
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^(wp-(content|admin|includes).*) $1 [L] # was "RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]"
    RewriteRule ^(.*\.php)$ $1 [L] # was "RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]"
    RewriteRule . index.php [L]
    
    # End Multisite Sub-Domain
    </IfModule>

    The commented out lines are for a SUB-DIRECTORY install. Those were the original ones recommended by WordPress (most likely a glitch from the migration).

    Also, in any LAMP (or similar), the directive:

    Header always set X-Frame-Options DENY

    conflicts with WordPress functionality. If you attempt to edit themes, view the media library, and other functions of WordPress that use frames, you may get only a blank page/half functionality. The best way I could find (through probably 12 hours of research) is to use this instead:

    Header always set X-Frame-Options SAMEORIGIN

    It works, I can edit themes again and all that jazz.

    In short, if you are using multisite wordpress:

    1) Check your .htaccess configuration and ensure it is correct for the type of MU you are using (sub-directory or sub-domain).

    2) Make sure you are not missing any files/have broken links in your WordPress install

    3) Gatorade, it’s what plants crave.

Viewing 1 replies (of 1 total)
  • The topic ‘Multisite Sub-Domain Incorrect Network Admin Dashboard Links’ is closed to new replies.