Skip to content

Instantly share code, notes, and snippets.

@litzinger
Forked from MaxLazar/Static rules
Created January 28, 2020 13:45
Show Gist options
  • Save litzinger/2a87406e26534aa728489df8ee641d90 to your computer and use it in GitHub Desktop.
Save litzinger/2a87406e26534aa728489df8ee641d90 to your computer and use it in GitHub Desktop.
Apache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/system [NC]
RewriteCond %{QUERY_STRING} !ACT|URL [NC]
RewriteCond %{REQUEST_METHOD} !=POST [NC]
RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
RewriteCond %{DOCUMENT_ROOT}/static/default_site/static%{REQUEST_URI}/index\.php -f
RewriteRule ^ /static/default_site/static%{REQUEST_URI}/index\.php [L,QSA]
</IfModule>
NGINX
if ($request_method !~* GET) {
set $request_var nonget;
}
if ($args ~* (ACT|URI)) {
set $uri_var acturl;
}
if (-e $document_root/static/default_site/static/$request_uri$request_var$uri_var/index.php) {
rewrite ^(.*) /static/default_site/static/$request_uri/index.php last;
}
Apache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/system [NC]
RewriteCond %{QUERY_STRING} !ACT|URL [NC]
RewriteCond %{REQUEST_METHOD} !=POST [NC]
RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
RewriteCond %{DOCUMENT_ROOT}/STATIC_PATH/SITE_NAME/static%{REQUEST_URI}/index\.php -f
RewriteRule ^ /STATIC_PATH/SITE_NAME/static%{REQUEST_URI}/index\.php [L,QSA]
</IfModule>
NGINX
if ($request_method !~* GET) {
set $request_var nonget;
}
if ($args ~* (ACT|URI)) {
set $uri_var acturl;
}
if (-e $document_root/STATIC_PATH/SITE_NAME/static/$request_uri$request_var$uri_var/index.php) {
rewrite ^(.*) /STATIC_PATH/SITE_NAME/static/$request_uri/index.php last;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment