Fix preview deploy without root htaccess

This commit is contained in:
Clément SAILLANT
2026-03-14 17:40:50 +00:00
parent 4a1d3a2c18
commit 58f8011657
2 changed files with 20 additions and 0 deletions
@@ -47,6 +47,19 @@ Fichier :
Script cible :
- `scripts/deploy-ovh-ftp-target.sh`
## Note preview
Le preview ne doit pas embarquer le `.htaccess` de la racine.
Raison :
- ce fichier contient des regles Apache pensees pour `/`
- notamment des chemins absolus comme `/index.html` et `/_astro/`
- dans `/preview`, ces regles peuvent provoquer un `403 Forbidden`
Decision :
- la cible `preview` retire `dist/.htaccess` avant synchronisation FTP
- la cible `production` conserve le `.htaccess` pour la racine publique
## Usage
### Preview
+7
View File
@@ -63,6 +63,13 @@ main() {
echo "[deploy-ovh-ftp-target] Skipping build:external (already built)."
fi
# The root .htaccess contains root-scoped Apache rules (`/index.html`, `/_astro/`)
# that break the preview when uploaded inside `/preview`.
if [[ "$TARGET" == "preview" && -f "${LOCAL_DIR}/.htaccess" ]]; then
echo "[deploy-ovh-ftp-target] Removing .htaccess from preview payload."
rm -f "${LOCAL_DIR}/.htaccess"
fi
bash scripts/deploy-ovh-ftp.sh "$LOCAL_DIR"
}