WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Unable to access admin pages, domains are reachable for non-logged in users (4 posts)

  1. fka
    Member
    Posted 2 years ago #

    Non-logged in users can reach the main pages (no content yet) of multiple domains; however, when attempting to log in the network site, the browser keeps looping back to a login page with address: http://10.10.10.10/wp-login.php?redirect_to=http%3A%2F%2F10.10.10.10%2Fwp-admin%2F&reauth=1. This happens on all domains in the multisite install (with the domain name in place of IP 10.10.10.10).

    I'll keep using private IP addresses here even though the real ones are public. This is a fresh setup of virtuozzo VPS running latest stable releases of CentOS, Apache, mysql, PHP5 (with SuExec and fastcgi) and WP.

    To ease admin tasks, I ordered WHM/cPanel which took one of the available 8 IP addresses. Domains are created in path: /home/username/public_html. So now I have:

    • main server (no domain attached) = 10.10.10.10
    • Domain1.com = 10.10.10.20
    • Domain2.com = 10.10.10.21
    • ... and so on for 5 more domains

    I need multisite subdomain functionality. So I installed WP in /home directory and all domains are basically getting their requests from an IP address (10.10.10.10). DNS is resolving domains to IP addresses fine. All domains in vhosts are configured including wildcard subdomains correctly in httpd.conf and php.ini has base_dir = /home

    The problem is .htaccess file and I have been researching and making changes for 5 days now, that I don't even remember how the original wp-config.php or .htaccess look like. I am looking for a solution to have all the domains including admin pages accessible from /home directory in this one IP address.

    This is my wp-config.php file (past the DB and keys sections):

    define('WP_DEBUG', true);
    define('WP_ALLOW_MULTISITE', true);
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', true );
    $base = './home';
    define( 'DOMAIN_CURRENT_SITE', '10.10.10.10' );
    define( 'PATH_CURRENT_SITE', './home' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );
    define( 'WP_CONTENT_URL', 'http://10.10.10.10/wp-content');
    define( 'PLUGINDIR', 'http://10.10.10.10/wp-content/plugins');
    define('FS_METHOD', 'ftpsockets');
    define( 'FTP_CONTENT_DIR', 'http://10.10.10.10/wp-content');
    define( 'FTP_PLUGIN-DIR', 'http://10.10.10.10/wp-content/plugins');
    /* That's all, stop editing! Happy blogging. */

    This is my .htaccess file (the second commented line give same results, while all commented will throw an error message on admin pages: the page has moved permanently here - the here points to http:/// ):

    # RewriteEngine On
    # RewriteCond %{HTTP_HOST} ^10.10.10.10$
    # RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    
    <IfModule mod_security.c>
    <Files async-upload.php>
    SecFilterEngine Off
    SecFilterScanPOST Off
    </Files>
    
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    
    # 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]
    </IfModule>
  2. You can't use subDOMAINS if you're using IP addresses in WP.

    You have to actually use a domainname in WP to do that.

  3. fka
    Member
    Posted 2 years ago #

    Thanks Ipstenu.
    OK, so after spending some time with this, I decide to reinstall. Removed DB and created new one (different name) and no plugins or themes added. Apache handles the directory redirects in httpd.conf

    Beginning the install went fine and I made sure I can look at different pages in dashboard, then created network, copied lines provided in .htaccess and wp-config.php (I use notepad++) and when I went to logon again I got internal server error page. Apache's error logs say: RewriteRule: bad argument line '^([_0-9a-zA-Z-]+/)?files/(.+)'

    So, after looking at some threads, the only thing I could safely add is the word blog as recommended here

    Here's what .htaccess file contain:

    RewriteEngine On
    RewriteBase /blog/
    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]

  4. fka
    Member
    Posted 2 years ago #

    Solved the last problem. There is a space beneath the #uploaded files line, once removed in .htaccess the error stopped. I got a white screen and the problem came from file permissions. This article recommends setting wp-config.php permissions to 600 resulting in php error because it can't be opened from a call from wp-load.php and once the permissions changed 660 it started working.
    The front page of the sites are reachable too.
    Thanks for all the assistance. There is a wealth of information in the mutisite forum thanks to Ipstenu and Andrea.

Topic Closed

This topic has been closed to new replies.

About this Topic