A different document root for beta users?

I have a wordpress based php application running on apache on ubuntu server. I have developed a new version of the application, and I’d like only certain users to access this beta.
My server’s structure is like this:
/var/www/site
/var/www/betasite

I don’t want these users to run the site of a different domain/subdomain. Both the sites are supposed to run off the same wordpress database and hence need the same domain. Changing the wordpress theme based on the session/cookie is also not a possibility because I have a lot of assets/plugins which are outside the wp-content/themes folder.

Read More

I was thinking of giving beta users a cookie, and redirect requests with those cookies to the new document root. I have been trying to mess around with htaccess’s mod_rewrite, but after a lot of experimentation, I figured that mod_rewrite cannot redirect to stuff outside apache’s document root.
I need a virtual host setup based on the cookie in the request header. Any ideas?

Related posts

Leave a Reply

2 comments

  1. Running it under a separate (sub)domain really is the best option. There is no reason that you cannot use the same database across both instances provided that both site versions can use the same database schema.

    The only problem you may see is a WordPress specific one. For example, there may be a config table in the database that which has a field for the current domain name or hostname. My suggestion would be to simply change/fix the wordpress code so it can work without this variable by simply detecting the correct hostname from the $_SERVER variables.

  2. try an alias in your vhost configuration

    <VirtualHost *:80>
    
        #config...
    
        <Directory "/path/to/doc/root">
            #config...
        </Directory>
    
        Alias /beta /path/to/beta/root
        <Directory "/path/to/beta/root">
            #config..
        </Directory>
    
    </VirtualHost>