Skip to content

Instantly share code, notes, and snippets.

@graybill
Created April 5, 2010 20:47
Show Gist options
  • Save graybill/356864 to your computer and use it in GitHub Desktop.
Save graybill/356864 to your computer and use it in GitHub Desktop.
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule . - [L]
# pass thru files from the domain-specific design/public/ directory
RewriteCond %{HTTP_COOKIE} DESIGN=([^;]+) [NC]
RewriteCond %{DOCUMENT_ROOT}/app/view/web/%{HTTP_HOST}/%1/public%{REQUEST_URI} -f
RewriteRule (.*) app/view/web/%{HTTP_HOST}/%1/public/$1 [L]
# pass thru files from the domain-specific default/public/ directory
RewriteCond %{DOCUMENT_ROOT}/app/view/web/%{HTTP_HOST}/default/public%{REQUEST_URI} -f
RewriteRule (.*) app/view/web/%{HTTP_HOST}/default/public/$1 [L]
# pass thru files from the web/default/public/ directory
RewriteCond %{DOCUMENT_ROOT}/app/view/web/default/public%{REQUEST_URI} -f
RewriteRule (.*) app/view/web/default/public/$1 [L]
# pass thru files from the shared/public/ directory
RewriteCond %{DOCUMENT_ROOT}/app/view/shared/public%{REQUEST_URI} -f
RewriteRule (.*) app/view/shared/public/$1 [L]
# route media to correct directory
RewriteRule ^media/(.*)$ build/media/%{HTTP_HOST}/$1 [L]
# route cms asset files
RewriteRule ^cms/assets/(.+)$ build/deploy/cms/assets/$1 [L]
# route asset files
RewriteCond %{HTTP_COOKIE} DESIGN=([^;]+) [NC]
RewriteCond %{DOCUMENT_ROOT}/build/deploy/%{HTTP_HOST}/%1/%{REQUEST_URI} -f
RewriteRule ^assets/(.+)$ build/deploy/%{HTTP_HOST}/%1/assets/$1 [L]
RewriteRule ^assets/(.+)$ build/deploy/%{HTTP_HOST}/default/assets/$1 [L]
# route all requests to index
RewriteRule ^(.*)$ web.php [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment