Static HTML
Using the rsconnect CLI
This example command deploys a static HTML file to Posit Connect, assuming that you set up a server named myServer when configuring your account:
Terminal
rsconnect deploy html -n myServer index.htmlDeploying a single HTML file
Specifying a file in the path includes only that file in the deploy bundle, not the entire directory.
For example, using the following directory:
├─ my_project/
│ ├─ index.html
│ ├─ second.htmland the following command:
Terminal
rsconnect deploy html -n myServer my_project/second.htmlyou get a bundle that includes second.html.
Deploying a directory containing HTML files
Specifying a directory in the path includes that entire directory, its subdirectories, and their contents in the deploy bundle. Connect includes the entire directory whether or not you supply an entrypoint.
For example, using the following directory:
├─ my_project/
│ ├─ index.html
│ ├─ second.htmland the following command:
Terminal
rsconnect deploy html -n myServer my_projector, this command:
Terminal
rsconnect deploy html \
-n myServer my_project \
-e my_project/index.htmlyou get a bundle that includes both index.html and second.html.
Specifying an entrypoint
Providing an entrypoint is optional if there is an index.html inside the project directory, or if there is a single HTML file in the project directory.
If there are multiple HTML files in the project directory and it contains no index.html, you will get an exception when deploying that directory unless you specify an entrypoint.
If you want to specify an entrypoint and you are executing the deploy command outside a project folder, you must specify the full path of the entrypoint:
Terminal
rsconnect deploy html \
-n myServer my_project \
-e my_project/second.htmlIf you want to specify an entrypoint and you are executing the deploy command inside the project folder, you can abbreviate the entrypoint, like so:
Terminal
cd my_project
rsconnect deploy html -n myServer ./ -e second.htmlIncluding extra files
The directory deployment method is the easiest way to include extra files in bulk. To selectively add files instead, specify them on the command line after the path:
For example, using the following directory:
├─ my_project/
│ ├─ index.html
│ ├─ second.html
│ ├─ third.html
│ ├─ fourth.htmlTerminal
cd my_project
rsconnect deploy html \
-n myServer \
index.html \
third.html \
fourth.htmlyou get a bundle that includes index.html, third.html and fourth.html.
Serving files
Connect uses exact path matching. A request for /page.html serves page.html from your bundle.
For directory paths, Connect serves index.html from that directory. Connect handles directory requests as follows:
| Request | Result |
|---|---|
/docs |
Serves docs/index.html (via redirecting to /docs/) |
/docs/ |
Serves docs/index.html |
/docs/index.html |
Serves docs/index.html |
/docs/page.html |
Serves docs/page.html |
/page.html |
Serves page.html |