# Apache modules cgi_module, env, rewrite and alias must be loaded before
# Take a look in your main apache configuration!

RewriteEngine on
# do not rewrite static URLs
RewriteRule ^/webmcp-demo/static/(.*)$ /webmcp-demo/static/$1
# dynamic URLs
RewriteRule ^/webmcp-demo/([^\?]+)/(\?(.*))?$ /webmcp-demo/webmcp-wrapper.lua?_webmcp_path=$1&$2

# Directly serve static files
Alias /webmcp-demo/static /__INSERT_LOCAL_FILE_PATH_TO_DEMO_APPLICATION_HERE__/static

# Connect extarnal path to the webmcp cgi interface
ScriptAlias /webmcp-demo/ /__INSERT_LOCAL_FILE_PATH_TO_WEBMCP_FRAMEWORK_HERE__/cgi-bin/

# Allow CGI execution for the webmcp CGI interface
<Directory "/__INSERT_LOCAL_FILE_PATH_TO_WEBMCP_FRAMEWORK_HERE__/cgi-bin">
    AllowOverride None
    Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

# Configure environment for demo application    
<Location /webmcp-demo>
    SetEnv WEBMCP_APP_BASEPATH '/__INSERT_LOCAL_FILE_PATH_TO_DEMO_APPLICATION_HERE__'
    SetEnv WEBMCP_CONFIG_NAME 'demo'
</Location>

