<VirtualHost *>
    ServerName www.nstein.dev
    DocumentRoot /var/www/wcm/cmf-www-sampleapp/public/
    DirectoryIndex index.php

    RewriteEngine On

    # Rule for all media, js and css files.
    RewriteRule ^([a-zA-Z0-9_\-/]+).(js|ico|gif|jpg|png|css|swf)$ /$1.$2 [L,QSA]

    # Rule for controllers (no action).
    RewriteRule ^/([a-zA-Z0-9_\-]+)/([0-9]+) /index.php?controllerName=$1&id=$2 [L,QSA]

    # Rule for other controllers (with action).
    RewriteRule ^/([a-zA-Z0-9_\-]+)/([0-9]+)?action=([a-zA-Z0-9_\-]*) /index.php?controllerName=$1&id=$2&action=$3 [L,QSA]
    
    <IfModule sqlalias_module>
        SQLAliasEnable  On
        
        SQLAliasDbParam hostname 127.0.0.1
        SQLAliasDbParam username "root"
        SQLAliasDbParam password null
        SQLAliasDbParam database "sqlalias"
        SQLAliasDbParam port 3306
        
        SQLAliasQuery "SELECT destination FROM sampleapp_sqlalias WHERE alias='%s' LIMIT 1"
        SQLAliasFilter \.(js|ico|gif|jpg|png|css|swf|php)$
    </IfModule>

</VirtualHost>

<VirtualHost *>
    ServerName preview.nstein.dev
    DocumentRoot /var/www/wcm/cmf-www-sampleapp/public/
    DirectoryIndex preview.php

    RewriteEngine On

    # Rule for all media, js and css files.
    RewriteRule ^([a-zA-Z0-9_\-/]+).(js|ico|gif|jpg|png|css|swf)$ /$1.$2 [L,QSA]

    # Rule for controllers (no action).
    RewriteRule ^/([a-zA-Z0-9_\-]+)/([0-9]+) /preview.php?controllerName=$1&id=$2 [L,QSA]
    
    # Rule for other controllers (with action).
    RewriteRule ^/([a-zA-Z0-9_\-]+)/([0-9]+)?action=([a-zA-Z0-9_\-]*) /preview.php?controllerName=$1&id=$2&action=$3 [L,QSA]

    <IfModule sqlalias_module>
        SQLAliasEnable  On

        SQLAliasDbParam hostname 127.0.0.1
        SQLAliasDbParam username "root"
        SQLAliasDbParam password null
        SQLAliasDbParam database "sqlalias"
        SQLAliasDbParam port 3306
    
        SQLAliasQuery "SELECT destination FROM sampleapp_sqlalias WHERE alias='%s' LIMIT 1"
        SQLAliasFilter \.(js|ico|gif|jpg|png|css|swf|php)$
    </IfModule>

</VirtualHost>

<VirtualHost *>
    ServerName debug.nstein.dev
    DocumentRoot /var/www/wcm/cmf-www-sampleapp/public/

    RewriteEngine On
    DirectoryIndex debug.php

    # Rule for all media, js and css files.
    RewriteRule ^([a-zA-Z0-9_\-/]+).(js|ico|gif|jpg|png|css|swf)$ /$1.$2 [L,QSA]
    
    # Rule for controllers (no action).
    RewriteRule ^/([a-zA-Z0-9_\-]+)/([0-9]+) /debug.php?controllerName=$1&id=$2 [L,QSA]
    
    # Rule for other controllers (with action).
    RewriteRule ^/([a-zA-Z0-9_\-]+)/([0-9]+)?action=([a-zA-Z0-9_\-]*) /debug.php?controllerName=$1&id=$2&action=$3 [L,QSA]
    
    <IfModule sqlalias_module>
        SQLAliasEnable  On
    
        SQLAliasDbParam hostname 127.0.0.1
        SQLAliasDbParam username "root"
        SQLAliasDbParam password null
        SQLAliasDbParam database "sqlalias"
        SQLAliasDbParam port 3306
    
        SQLAliasQuery "SELECT destination FROM sampleapp_sqlalias WHERE alias='%s' LIMIT 1"
        SQLAliasFilter \.(js|ico|gif|jpg|png|css|swf|php)$
    </IfModule>
</VirtualHost>

