-
Notifications
You must be signed in to change notification settings - Fork 5
Clean URLs & Default Indexing
Darshan edited this page Oct 27, 2024
·
1 revision
With Clean URLs, you can remove file extensions from the URL path, making the URLs shorter and more user-friendly.
Example: Access functions.app/contact instead of functions.app/contact.html.
To enable Clean URLs for specific file extensions, use:
appExpress.cleanUrls(['html', 'txt']);The cleanUrls function accepts an array of file extensions to exclude from URLs, ensuring that paths are simplified
without changing file structure.
You can also enable default indexing to serve index.html automatically for directories:
appExpress.serveIndex(true);With this enabled:
- Navigating to
/will serveindex.html. - Navigating to
/contactwill servecontact/index.html.
This feature allows users to access directory-based content seamlessly, further improving URL readability and usability.