WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] multisite installation redirection problem possibly htaccess issue (14 posts)

  1. kaleidoscopeint
    Member
    Posted 2 years ago #

    Hi, This is what i have :
    site1 is in the main html directory /html/ its a sub directory install
    wpconfig:

    define('WP_ALLOW_MULTISITE', true);
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', false );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', 'site1.com' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    htaccess:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [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).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]

    Site 2 is in /html/site2/
    wp-config:

    define('WP_ALLOW_MULTISITE', true);
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', true );
    $base = '/site2/';
    define( 'DOMAIN_CURRENT_SITE', 'site2.com' );
    define( 'PATH_CURRENT_SITE', '/site2/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    htaccess:

    RewriteEngine On
    RewriteBase /site2/
    RewriteRule ^index\.php$ - [L]
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]

    I have site2.com set up with a wildcard configuration, this was done by the hosting people. The problem is that when i go to 123.site2.com it redirects me to site1.com . Site 2 has its own domain name pointing to the site2 directory. When I go to site2.com it goes to the right place, the problem is the subdomains redirecting to site1.com.
    Any help is greatly appreciated.
    Thanks
    DD

  2. Site 2 is in /html/site2/

    That's not Multisite. Multisite doesn't have a second 'folder' for a second site, it's all virtual. UNLESS you're trying to setup site2 as a separate multisite instance, we're doing this wrong.

    ASSUMING site2 is an addon domain, the .htaccess and wp-config should NOT point to /site2/ but just /

    Why? Because insofar as site2 knows, it IS root.

  3. kaleidoscopeint
    Member
    Posted 2 years ago #

    My apologies, upon reading the question again i realized it was "hazy" at best. You assumed correctly, they are both multisite installs, and the addon domain's(site2) original wp-config and htaccess are below. Any subdomain request ie. 123.site2.com gets redirected to site1.com.
    Thanks
    dd

    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', true );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', 'www.tellyourlovestory.com' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
  4. That sounds like the way you set up subdomains, I'm afraid. Double check with your hosts if the wildcard subdomain for site2 is pointed at /public_html/ or /public_html/site2 (it SHOULD be the latter)

  5. kaleidoscopeint
    Member
    Posted 2 years ago #

    This is the email I got from my hosting people in regards to why the subdomain was redirecting to the main site. eight32.com is site1.com and premiumwebspots.com is site2.com.
    Thanks
    DD

    As it turns out, this is working properly. It appears there is a hidden redirect, somewhere, that is causing this. Below are the DNS results, the http headers from my browser, as well as the entries from the httpd.conf file.

    $ host premiumwebspots.com
    premiumwebspots.com has address 69.36.181.212
    $ host reedstest.premiumwebspots.com
    reedstest.premiumwebspots.com is an alias for premiumwebspots.com.
    premiumwebspots.com has address 69.36.181.212

    http://april.premiumwebspots.com/

    GET / HTTP/1.1
    Host: april.premiumwebspots.com
    User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20100101 Firefox/11.0
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip, deflate
    DNT: 1
    Connection: keep-alive

    HTTP/1.1 302 Found
    Date: Tue, 27 Mar 2012 17:20:44 GMT
    Server: Apache/2.0.52 (Red Hat)
    X-Powered-By: PHP/5.3.8
    Location: http://eight32.com/
    Content-Length: 0
    Keep-Alive: timeout=1, max=100
    Connection: Keep-Alive
    Content-Type: text/html
    ----------------------------------------------------------

    <VirtualHost *:80>
    ServerName premiumwebspots.com
    ServerAlias http://www.premiumwebspots.com
    DocumentRoot /var/www/html/premiumspots
    </VirtualHost>
    <VirtualHost *:80>
    ServerName *.premiumwebspots.com
    ServerAlias www.*.premiumwebspots.com
    DocumentRoot /var/www/html/premiumspots
    </VirtualHost>

    Where redirects are considered custom, technical support is not able to fix them for you, however, I have looked in all the normal files that would do this, and cannot find anything that would cause this.

  6. kaleidoscopeint
    Member
    Posted 2 years ago #

    I just read up a little on .htaccess rules and they said that rules affect all the directories in the directory that the .htaccess file is in. Could this be the issue? Site1's .htaccess file is taking over control.

  7. Axel13
    Member
    Posted 2 years ago #

    You wouldn't happen to use a plugin that copies all settings from one site to another, like YD Network-wide options?
    I've had a similar situation, noticed it was my mistake setting the home &/or siteurl of 123.site2.com to site2.com instead of the subdomain.

  8. kaleidoscopeint
    Member
    Posted 2 years ago #

    No I did a fresh install on both of them.

  9. Axel13
    Member
    Posted 2 years ago #

    Am I assuming correct that you have 2 wordpress installations? I think you need only the one in the root, or better yet, only the one in the root could be a multisite.

  10. kaleidoscopeint
    Member
    Posted 2 years ago #

    I want, and have 2 multisite installations, one is in the root, and another is in a subdirectory, but apparently the root installation is causing problems with the redirection of the one in the subdomain.

  11. Axel13
    Member
    Posted 2 years ago #

    2. Install WordPress 3.3.1
    Install WordPress 3.3.1 to the root of your public_html directory. It has to be at the root or the multi-site feature won't work. Follow the instructions for Installing WordPress in the Codex.

    source: http://codex.wordpress.org/Migrating_Multiple_Blogs_into_WordPress_3.0_Multisite

    I guess that's not good news, but it's how it is :(

  12. Could this be the issue? Site1's .htaccess file is taking over control.

    Highly unlikely.... I mean, possible yes. You can test by renaming site1's .htaccess to old.htaccess and see what happens.

    (Axel - You don't HAVE to have WP in root, that's something else. It could be clearer, but I promise you, a subdirectory is fine).

  13. kaleidoscopeint
    Member
    Posted 2 years ago #

    I'm going to move site1 to another directory and use another domain and see if that solves the issue. Thanks for your help.

  14. kaleidoscopeint
    Member
    Posted 2 years ago #

    Ok finally got this sorted out!
    I moved the Multisite install over to its own directory with a dif domain name and nothing. I then got back to the hosting ppl and finally ran into one that had a clue, and wanted to be helpful.

    [12:13:21 PM] It looks like the httpd.conf file is trying to set the wildcard as its own virtualhost, using ServerName, instead of ServerAlias.

    : [12:22:32 PM] Technically, the site manager doesn't support this sort of wildcard domain configuration, and is thus beyond the scope of our technical support. However, you simple need to edit "/etc/httpd/conf/httpd.conf" around line 1150 and set the ServerName to "premiumwebspots.com" and the ServerAlias to "*.premiumwebspots.com"

    This is what the settings were looking like before:

    <VirtualHost *:80>
    ServerName *.premiumwebspots.com
    ServerAlias www.*.premiumwebspots.com
    DocumentRoot /var/www/html/premiumspots
    </VirtualHost>

    I made the changes restarted the server and bingo!
    Thanks for the help guys.
    David

Topic Closed

This topic has been closed to new replies.

About this Topic