Static Deployments let you control the HTTP headers, routing rules, and URL rewrites for your static website.
Access-Control-Allow-Origin
header to specify which domains the browser can access for that page.
To create this entry, add the following to the .replit
file in your Replit App’s root directory:
deployment.responseHeaders
entries to the .replit
file.
To apply configuration updates, redeploy your Replit App.
404.html
in the root directory of your Replit App.
When users attempt to access a URL path that doesn’t exist, they see the rendered HTML of the custom 404 page.
/app
load the contents of the /app/index.html
file.
To create this entry, add the following to the .replit
file in your Replit App’s root directory:
deployment.rewrites
entries to the .replit
file.
The server interprets the entries in the listed order and ignores duplicates.
To apply configuration updates, you must redeploy your Replit App.
The following sections describe URL rewrite rule constraints.
from
and to
parameters in rewrite rules:
*
is present*
matches the remainder of a path*
is only valid at the end of the path*
in the from
parameter, you can include it in the to
parameter to represent the matching section of the path.replit
file contains the following rewrite:
/v1/about-us.html
, the rewrite serves the file located at /v2/about-us.html
.
index.html
about.html
.replit
file contains the following rewrite:
/register.html
, the server rewrites the request to /index.html
and serves that file.
However, if a user visits /about.html
, the server ignores the rewrite and serves the about.html
file since it exists in your Static Deployment.