• For four months my WordPress site has been working super – no issues, smooth installation, special child theme, no problems.
    Here’s the site, which looks as it should and has:
    http://stephenzezza.com

    Out of the blue last week, Google starts returning this address when searching for the site:
    http://www.stephenzezza.com

    That should be fine, since the ‘www’ is a sub-domain and in the past has always resolved to http://example.com. But, in this case the domain with ‘www’ prefixed leads to what seems to the frontpage real site but with no stylesheet.

    1. I went to login to the dashboard to fix the prefix issue in Settings, and get the “Database Connection Error” error.

    2. I go to my host admin panel to actually ADD http://www.stephenzezza.com as a subdomain (which maybe I could forward to the non-‘www’ address), but the server tells me ‘www’ is already ‘included’ in the domain name, and I can’t add it.

    2. I ftp in and backup all the content, then checked out wp-config to see what DB WordPress was looking for, the user, and the password. It’s looking for a DB that’s not there (there’s only one database in the account), so I created it via PhpAdmin giving it all the info wp-config was looking for. I refresh everything and try to login again, and now I’m at the wordpress install screen.

    3. I put everything back the way it was. Should I proceed with the former installation process and upload all the backed up content to a fresh install?

    4. Also, how is the site at stephenzezza.com functioning if the wp-config file for the site doesn’t just have the wrong password or something, but is looking for a DB that isn’t even there?

    I really have tried everything I can think of…is it glaring me in the face and I just can’t see it? Thank you for any feedback…

Viewing 3 replies - 1 through 3 (of 3 total)
  • the ‘www’ is a sub-domain

    I do not know why it would need to be, and this is how I deal with that:

    # Rewrite non-www to www
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
    RewriteRule ^index\.php$ - [L]
    # Rewrite www to non-www
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
    RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
    RewriteRule ^index\.php$ - [L]

    http://forum.ait-pro.com/forums/topic/htaccess-redirect-www-to-non-www-htaccess-redirect-non-www-to-www/#post-1723

    I went to login to the dashboard to fix the prefix issue in Settings, and get the “Database Connection Error” error.

    Whatever you put in there is now the only thing your database can recognize and use. So, you will need to use phpMyAdmin to fix at least those two at the top of the _options table.

    the server tells me ‘www’ is already ‘included’ in the domain name, and I can’t add it.

    That simply means it will be sent to the same location where you have to deal with making the two into one.

    wp-config’s looking for a DB that’s not there

    Do you intend for the www to be a second website?

    now I’m at the wordpress install screen.

    A new database is empty and WordPress is prepared to make use of it.

    3. I put everything back the way it was. Should I proceed with the former installation process and upload all the backed up content to a fresh install?

    You do not need a new install unless you are making a new site, and you would need a copy of the database to restore one.

    4. Also, how is the site at stephenzezza.com functioning if the wp-config file for the site doesn’t just have the wrong password or something, but is looking for a DB that isn’t even there?

    The database is there or you would have no site. So, I suspect you are not seeing it because the SQL user you are using at phpMyAdmin does not have permissions for it.

    Thread Starter Noos

    (@noos)

    Thank you leehjosepho, this is helpful, and I’m going to give it a shot.

    Btw, the non-www and www addresses should go to the same website. (www and non-www should look the same).

    Also, when I got to the install screen (after adding a new database to meet wp-config’s requirements above), would that have just setup the new DB for wordpress, or does this install result in a new installation of WP? I have backups of all the content, but no backed up database…

    diving in…

    the non-www and www addresses should go to the same website. (www and non-www should look the same).

    If I have understood correctly, you only want one or the other to actually land at your site since search engines expect to find only one or the other landing there. So, the idea is to redirect either to the other with htaccess so only the remaining one ever shows up in any SEO indexing.

    Also, when I got to the install screen (after adding a new database to meet wp-config’s requirements above), would that have just setup the new DB for wordpress…

    Not *the* new database, but *a* new database…and then an existing site could use it to re-begin at “square one”.

    …or does this install result in a new installation of WP?

    No, all else would have to be in place beforehand. So, you have apparently (even if inadvertently) simply told wp-config.php you want a new database for an existing installation.

    I have…no backed up database…

    It is still there at the server and the *new* set of tables (different table_prefix) might be in the same database…and to explain:

    At the server, a “database” is a database-named container for one or more sets of table_prefix-named tables commonly also called a “database”.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Strange database and domain prefix behavior’ is closed to new replies.