2

I'm looking to offer my users beta access to test new features. I'm running my site using the Symfony framework.

Currently I have the following working configuration:

mysite.com:

<VirtualHost *:80>
DocumentRoot /var/www/html/mysite/current/web
ServerName mysite.com
ServerAlias www.mysite.com
<Directory "/var/www/html/mysite/current/web">
    AllowOverride None
    Order Allow,Deny
    Allow from All      

    <IfModule mod_rewrite.c>
        Options -MultiViews
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ app.php [QSA,L]
    </IfModule>
</Directory>
</VirtualHost>

I attempted to serve a beta version of my site with the following config:

<VirtualHost *:80>
DocumentRoot /var/www/html/mysite_beta/current/web
ServerName beta.mysite.com
<Directory /var/www/html/mysite_beta/current/web>
AllowOverride None
    Require all granted
    Allow from All

    <IfModule mod_rewrite.c>
        Options -MultiViews
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ app.php [QSA,L]
    </IfModule>
</Directory>
</VirtualHost>

This did not work and Apache served only the content from the second configuration but with 404 errors for the resources like css and js files that are included.

I'm not familiar enough with configuring Apache to get this working as I intend.

How can I get 2 different codebases of my site running on the same Apache server?

2 Answers2

1

Verify that DNS resolves correctly for both mysite.com and beta.mysite.com. If Apache does not receive the HOST value in the header, it will use the first site that loaded.

Apache loads sites in alphabetical order.

Jeff W.
  • 511
-1

The configuration is fine but I can't see a

 NameVirtualhost *:80

Directive. Try to put it in the main configuration file