Skip to content

Instantly share code, notes, and snippets.

@mandrasch
Last active November 15, 2025 14:06
Show Gist options
  • Select an option

  • Save mandrasch/46a00c3ba6cd30efd183509f1ebb4f3d to your computer and use it in GitHub Desktop.

Select an option

Save mandrasch/46a00c3ba6cd30efd183509f1ebb4f3d to your computer and use it in GitHub Desktop.
use sveltekit/ and blog/ folder (e.g. WordPress) inside one domain root folder /web/matthias-andrasch.eu/ - apache webserver
DirectoryIndex sveltekit/index.html index.html index.php
RewriteEngine On
# ------------------------------------
# Error pages
# ------------------------------------
ErrorDocument 404 /sveltekit/errors/404.html
ErrorDocument 500 /sveltekit/errors/500.html
# ------------------------------------
# 1) Let WordPress handle /blog/*
# ------------------------------------
RewriteRule ^blog/ - [L]
# ------------------------------------
# 2) Serve existing root files/dirs as-is
# ------------------------------------
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# ------------------------------------
# 3) Serve existing FILES from /sveltekit
# ------------------------------------
RewriteCond %{DOCUMENT_ROOT}/sveltekit%{REQUEST_URI} -f
RewriteRule ^(.*)$ /sveltekit/$1 [L]
# ------------------------------------
# 4) Serve SvelteKit "directory pages" if index.html exists
# This also covers missing trailing slash
# ------------------------------------
RewriteCond %{DOCUMENT_ROOT}/sveltekit%{REQUEST_URI}/index.html -f
RewriteRule ^(.*)$ /sveltekit/$1/index.html [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment