diff --git a/README.md b/README.md index d3c520e..77d8ba4 100644 --- a/README.md +++ b/README.md @@ -249,9 +249,33 @@ npm run package # Serve the dist folder npx serve dist + +The website can be accessible at: http://localhost:3000/ + ``` -The website can be accessible at: ```http://localhost:3000/``` +**Subdirectory Hosting:** + +BentoPDF can also be hosted from a subdirectory (e.g., `example.com/tools/bentopdf/`): + +```bash + +# Example: +# 1. Build the app with the specific BASE_URL. BASE_URL must have a trailing and leading slash. The BASE_URL can be any url of your choice. Here we are using /tools/bentopdf/ as an example. + +BASE_URL=/tools/bentopdf/ npm run build + +# 2. Create the nested directory structure inside serve-test (or any folder of your choice for local testing. In case of production, create the nested directory structure inside the root directory) +mkdir -p serve-test/tools/bentopdf + +# 3. Copy all files from the 'dist' folder into that nested directory +cp -r dist/* serve-test/tools/bentopdf/ + +# 4. Serve the 'serve-test' folder +npx serve serve-test +``` + +The website can be accessible at: ```http://localhost:3000/tools/bentopdf/``` The `npm run package` command creates a `dist-{version}.zip` file that you can use for self-hosting. diff --git a/index.html b/index.html index 3dcd988..1a3fa00 100644 --- a/index.html +++ b/index.html @@ -5,11 +5,11 @@
diff --git a/src/pages/bookmark.html b/src/pages/bookmark.html index e4d1112..5004e59 100644 --- a/src/pages/bookmark.html +++ b/src/pages/bookmark.html @@ -18,18 +18,18 @@
diff --git a/src/pages/compress-pdf.html b/src/pages/compress-pdf.html index 0b7ea49..830e98c 100644 --- a/src/pages/compress-pdf.html +++ b/src/pages/compress-pdf.html @@ -16,17 +16,17 @@
diff --git a/src/pages/form-creator.html b/src/pages/form-creator.html index e0deb9b..6f4aa24 100644 --- a/src/pages/form-creator.html +++ b/src/pages/form-creator.html @@ -17,18 +17,18 @@
diff --git a/src/pages/jpg-to-pdf.html b/src/pages/jpg-to-pdf.html index fae13a1..2baf501 100644 --- a/src/pages/jpg-to-pdf.html +++ b/src/pages/jpg-to-pdf.html @@ -16,17 +16,17 @@
diff --git a/src/pages/json-to-pdf.html b/src/pages/json-to-pdf.html index a7df403..e0d359c 100644 --- a/src/pages/json-to-pdf.html +++ b/src/pages/json-to-pdf.html @@ -17,18 +17,18 @@
diff --git a/src/pages/merge-pdf.html b/src/pages/merge-pdf.html index 278c1eb..36f1d45 100644 --- a/src/pages/merge-pdf.html +++ b/src/pages/merge-pdf.html @@ -16,18 +16,18 @@
diff --git a/src/pages/pdf-multi-tool.html b/src/pages/pdf-multi-tool.html index 546ab11..f5fb555 100644 --- a/src/pages/pdf-multi-tool.html +++ b/src/pages/pdf-multi-tool.html @@ -46,9 +46,9 @@
diff --git a/src/pages/repair-pdf.html b/src/pages/repair-pdf.html index 43521da..407e21e 100644 --- a/src/pages/repair-pdf.html +++ b/src/pages/repair-pdf.html @@ -14,18 +14,18 @@
diff --git a/src/pages/split-pdf.html b/src/pages/split-pdf.html index ec664b3..ca3d264 100644 --- a/src/pages/split-pdf.html +++ b/src/pages/split-pdf.html @@ -16,18 +16,18 @@
diff --git a/src/pages/table-of-contents.html b/src/pages/table-of-contents.html index 71de3cc..f1073a5 100644 --- a/src/pages/table-of-contents.html +++ b/src/pages/table-of-contents.html @@ -17,18 +17,18 @@
diff --git a/vite.config.ts b/vite.config.ts index d91bcdd..49580bc 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,6 +4,7 @@ import { nodePolyfills } from 'vite-plugin-node-polyfills'; import { resolve } from 'path'; export default defineConfig(({ mode }) => ({ + base: process.env.BASE_URL || '/', plugins: [ tailwindcss(), nodePolyfills({