Start URL
The start_url parameter defines the URL that should be loaded when a user launches your PWA from their home screen or app launcher. This is typically the main entry point of your application.
Basic Usage
The simplest way to define a start URL is to provide a Symfony route name:
pwa:
manifest:
enabled: true
start_url: "app_homepage"You can also use a simple path string:
pwa:
manifest:
enabled: true
start_url: "/"Advanced Configuration
For more complex scenarios, you can use the full URL object configuration that allows you to specify route parameters and path types:
pwa:
manifest:
enabled: true
start_url:
path: "app_dashboard"
params:
utm_source: "pwa"
utm_medium: "homescreen"
path_type_reference: 1Path Parameter
The path parameter can be:
A Symfony route name (e.g.,
"app_homepage")An absolute URL (e.g.,
"https://example.com/app")A relative path (e.g.,
"/app")A network path (e.g.,
"//example.com/app")
Params Parameter
The params parameter allows you to pass route parameters or query string parameters:
pwa:
manifest:
start_url:
path: "app_article"
params:
id: 123
slug: "welcome"This is particularly useful for:
Tracking PWA installations with analytics parameters
Pre-loading specific content when the app launches
Passing initial state to your application
Path Type Reference
The path_type_reference option controls how the URL is generated:
0: Absolute URL - Generates a full URL with protocol and domain (e.g.,https://app.com/foo/bar)1: Absolute Path (default) - Generates a path starting from root (e.g.,/foo/bar)2: Relative Path - Generates a relative path (e.g.,../bar)3: Network Path - Generates a protocol-relative URL (e.g.,//app.com/foo/bar)
pwa:
manifest:
start_url:
path: "app_homepage"
path_type_reference: 0 # Absolute URLWhen using absolute URLs (path_type_reference: 0), make sure the Symfony Router Request Context is properly configured. This is especially important when generating the manifest outside of HTTP requests (e.g., in console commands).
Best Practices
Keep it within scope: The
start_urlmust be within the application'sscope.Use route names: Prefer Symfony route names over hardcoded paths for better maintainability.
Analytics tracking: Add tracking parameters to distinguish PWA launches from regular visits:
pwa:
manifest:
start_url:
path: "app_homepage"
params:
utm_source: "pwa"
utm_medium: "homescreen"Consistency: The
start_urlshould always resolve to the same logical page, even if the underlying route changes.
Examples
Simple Route
pwa:
manifest:
start_url: "app_dashboard"Route with Parameters
pwa:
manifest:
start_url:
path: "app_user_profile"
params:
username: "current"With Tracking Parameters
pwa:
manifest:
start_url:
path: "app_homepage"
params:
utm_source: "pwa"
utm_campaign: "install"
ref: "homescreen"Last updated
Was this helpful?