Skip to content

Commit c66263d

Browse files
coliseeRobin Alexander
andauthored
Fix sed instructions relative to file .htaccess (#199)
* Fix sed instructions relative to file .htaccess * Implement idempotent + simpler code (Ilkka Tengvall, John Villalovos) --------- Co-authored-by: Robin Alexander <colisee@hotmail>
1 parent 57155e3 commit c66263d

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

bin/entrypoint.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,16 @@ if [ -n "${APP_PATH}" ]; then
119119
fi
120120

121121
## Modify the .htaccess file
122+
pushd /var/www/html
123+
if ! [ -e .htaccess.orig ]; then
124+
cp --archive .htaccess .htaccess.orig
125+
fi
126+
127+
cp --archive .htaccess.orig .htaccess
122128
sed \
123-
-i /var/www/html/.htaccess \
124-
-e "s:\(RewriteCond .*\)/Web:\1/${APP_PATH}/Web:" \
125-
-e "s:\(RewriteRule .*\)/Web:\1/${APP_PATH}/Web:"
129+
-i .htaccess \
130+
-e "/^Rewrite/s:Web:${APP_PATH}/Web:"
131+
popd
126132
fi
127133

128134
# Send log files to /dev/stdout as background jobs

0 commit comments

Comments
 (0)