Skip to content

Instantly share code, notes, and snippets.

@mjau-mjau
Last active May 24, 2020 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjau-mjau/d9f8b53738ea805e5ad4636245a31fd3 to your computer and use it in GitHub Desktop.
Save mjau-mjau/d9f8b53738ea805e5ad4636245a31fd3 to your computer and use it in GitHub Desktop.
X3 .htaccess file for Apache with only required rules
# ---------------------------------------------------------------------------
# X3 REQUIRED
# Below rewrite rules are strictly required by X3 for pages to work properly.
# ---------------------------------------------------------------------------
<IfModule mod_rewrite.c>
# RewriteEngine enabled
RewriteEngine on
# RewriteBase (required for some hosts)
# If X3 is installed in root: RewriteBase /
# If X3 is installed in sub-directory x3: RewriteBase /x3
# RewriteBase /
# Rewrite any calls to html|json|xml|atom|rss if a folder matching * exists
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.+)\.(html|json|xml|atom|rss)$ index.php?$1/ [L]
# Rewrite any calls to /render to the X3 image resizer
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{QUERY_STRING} ^(?)debug($|&)
RewriteCond %{REQUEST_URI} render/
RewriteRule ^render/. app/parsers/slir/index.php?$1 [L]
# Rewrite routes to X3 application index.php if they are non-existent files/dirs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ index.php?/$1/ [L,QSA]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment