Skip to content

Commit

Permalink
docs: document the behaviour of paths on fallback pages (#11267)
Browse files Browse the repository at this point in the history
addresses #10235
  • Loading branch information
Rich-Harris authored Dec 12, 2023
1 parent 9c5bd58 commit 3adde58
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ The `fallback` page is an HTML page created by SvelteKit from your page template

On some hosts it may be `index.html` or something else entirely — consult your platform's documentation.

> Note that the fallback page will always contain absolute asset paths (i.e. beginning with `/` rather than `.`) regardless of the value of [`paths.relative`](/docs/configuration#paths), since it is used to respond to requests for arbitrary paths.
## Apache

To run an SPA on [Apache](https://httpd.apache.org/), you should add a `static/.htaccess` file to route requests to the fallback page:
Expand All @@ -58,4 +60,4 @@ If you want certain pages to be prerendered, you can re-enable `ssr` alongside `
/// file: src/routes/my-prerendered-page/+page.js
export const prerender = true;
export const ssr = true;
```
```
2 changes: 2 additions & 0 deletions packages/kit/src/exports/public.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ export interface KitConfig {
* If `true`, `base` and `assets` imported from `$app/paths` will be replaced with relative asset paths during server-side rendering, resulting in portable HTML.
* If `false`, `%sveltekit.assets%` and references to build artifacts will always be root-relative paths, unless `paths.assets` is an external URL
*
* [Single-page app](https://kit.svelte.dev/docs/single-page-apps) fallback pages will always use absolute paths, regardless of this setting.
*
* If your app uses a `<base>` element, you should set this to `false`, otherwise asset URLs will incorrectly be resolved against the `<base>` URL rather than the current page.
* @default undefined
*/
Expand Down
2 changes: 2 additions & 0 deletions packages/kit/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ declare module '@sveltejs/kit' {
* If `true`, `base` and `assets` imported from `$app/paths` will be replaced with relative asset paths during server-side rendering, resulting in portable HTML.
* If `false`, `%sveltekit.assets%` and references to build artifacts will always be root-relative paths, unless `paths.assets` is an external URL
*
* [Single-page app](https://kit.svelte.dev/docs/single-page-apps) fallback pages will always use absolute paths, regardless of this setting.
*
* If your app uses a `<base>` element, you should set this to `false`, otherwise asset URLs will incorrectly be resolved against the `<base>` URL rather than the current page.
* @default undefined
*/
Expand Down

0 comments on commit 3adde58

Please sign in to comment.