开发者

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.

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 documen开发者_开发百科t root.

I need a virtual host setup based on the cookie in the request header. Any ideas?


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.


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜