• I have two WordPress installs on the server. One is the current site that is several years old. We are redesigning the site and upgrading the WP install and, very long story short, we created a BETA folder that I installed the new WP and the new theme into.

    When I go into the BETA folder the new homepage shows. But whenever I click a link the server tries to use the old, original WP install, so all of the pages look broken.

    We still need to go in and add a bunch of content, which we can do but then we can’t see how it looks on the front end.

    I tried to find a solution to this but I’m at a loss.

    Does anyone know of a way to make the new WP install work in the BETA folder and show the new site without affecting the current site/install?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Do you have any links?

    Thread Starter Anthony Laurence

    (@ant1881)

    Thanks for responding.

    You can see the Beta at http://pacharters.org/_BETA

    So is your beta site using the same database as your old site?

    If so, WordPress doesn’t officially support this because the database actually stores the domain name in the database for all the links like menus, etc.

    But, you might be able to get around it with the code below. Add it to your wp-config.php on your beta site.

    define( 'WP_HOME',          'http://' . $_SERVER['HTTP_HOST'] );
    define( 'WP_SITEURL',       'http://' . $_SERVER['HTTP_HOST'] );
    define( 'WP_PLUGIN_DIR',    realpath(   $_SERVER['DOCUMENT_ROOT']   . '/_BETA/wp-content/plugins' ) );
    define( 'WP_PLUGIN_URL',    'http://' . $_SERVER['HTTP_HOST']       . '/_BETA/wp-content/plugins' );
    define( 'WP_THEMES_DIR',    realpath(   $_SERVER['DOCUMENT_ROOT']   . '/_BETA/wp-content/themes' ) );
    define( 'WP_THEMES_URL',    'http://' . $_SERVER['HTTP_HOST']       . '/_BETA/wp-content/themes' );
    define( 'WP_CONTENT_DIR',   realpath(   $_SERVER['DOCUMENT_ROOT']   . '/_BETA/wp-content' ) );
    define( 'WP_CONTENT_URL',   'http://' . $_SERVER['HTTP_HOST']       . '/_BETA/wp-content' );

    Please note that if you did not use relative links in your original site, and hardcoded http://pacharters.org/my/special/link then those links (usually in the editor) will go back to the old site. Those links will have to be changed to /my/special/link without http:// or the domain.

    I use “beta” sites quite often and the method above (plus relative links) usually works okay for me. But, sometimes, with themes especially, things can still go haywire.

    Thread Starter Anthony Laurence

    (@ant1881)

    Thanks. I tried the code above but no changes. I already have the WP_HOME and WP_SITE urls set for the Beta folder. I tried the rest of the code but nothing.

    I checked and the links aren’t an issue. Most of the menu links are generated by WP, and the paths look right.

    It’s funny, because when you click on About Us, for example, the URL it uses is pacharters.org/_BETA/about-us, as it is supposed to, but it uses the old theme. But it doesn’t pull in any content because I’m using a new database.

    I’ve used Beta folders in the past and this is the first time I have had this issue….

    I know the developer for the old site had some “creative” ways that he coded their site. Do you think it might be a configuration that he used? Maybe an htaccess directive?

    That tells me that maybe there’s something going on with the permalinks/.htaccess. So the Apache server (I’m assuming you’re using Apache) is given /_BETA/pretty/permalink as a request but isn’t seeing anything configured for the _BETA site, so it’s reverting to the .htaccess in the root folder which is your old site which is serving up a 404 as it should.

    Do you have a .htaccess (are you using Apache?) in your _BETA folder? Are you running a VPS or using a shared hosting (who’s your hosting provider)?

    Thread Starter Anthony Laurence

    (@ant1881)

    There is an htaccess in the Beta folder.

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    After that is code for GZipping and settings for the caching plugin, which shouldn’t affect this.

    We are using Apache on a shared server through Siteground.

    Thread Starter Anthony Laurence

    (@ant1881)

    FYI, here is the htaccess for the old site:

    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule !^index\.php$ index.php [NC]
    ErrorDocument 404 /_repot/error/404.html
    ErrorDocument 500 /_repot/error/500.html
    ErrorDocument 503 /_repot/error/503.html
    # BEGIN W3TC Browser Cache
    <IfModule mod_deflate.c>
        <IfModule mod_headers.c>
            Header append Vary User-Agent env=!dont-vary
        </IfModule>
            AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
        <IfModule mod_mime.c>
            # DEFLATE by extension
            AddOutputFilter DEFLATE js css htm html xml
        </IfModule>
    </IfModule>
    # END W3TC Browser Cache
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Not sure if this helps. htaccess calls aren’t my strong suite….

    I am a little worried that some of that .htaccess may be bothering the other site. Siteground is a great host, their support is great and I would highly recommend them.

    But, have you tried changing your .htaccess on the old site to just:

    # BEGIN W3TC Browser Cache
    <IfModule mod_deflate.c>
        <IfModule mod_headers.c>
            Header append Vary User-Agent env=!dont-vary
        </IfModule>
            AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
        <IfModule mod_mime.c>
            # DEFLATE by extension
            AddOutputFilter DEFLATE js css htm html xml
        </IfModule>
    </IfModule>
    # END W3TC Browser Cache
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    I’m worried that:

    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule !^index\.php$ index.php [NC]
    ErrorDocument 404 /_repot/error/404.html
    ErrorDocument 500 /_repot/error/500.html
    ErrorDocument 503 /_repot/error/503.html

    …is causing some issues since it’s base is / which might be applying to /_BETA. BTW I’ve always setup my beta sites via something like beta.example.com just so you don’t run into these kinds of issues.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Dual WordPress installs’ is closed to new replies.