Skip to content

Commit 802c843

Browse files
author
Andrew Wilson
committed
Fix .htaccess-lando not being read when present.
Apache looks for `.htaccess` files in the order listed in `AccessFileName`, reading only the first one it finds. Lando is supposed to change that list, but it isn't working. See: https://github.com/lando/lando/issues/2277 This project needs the updated `AccessFileName` list so the `.htaccess` file on the server can include Shibboleth statements that will cause errors in Lando, while the local, Lando-specific file, excludes them.
1 parent df2b34b commit 802c843

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

.lando.yml

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ config:
55

66
services:
77
appserver:
8+
build_as_root:
9+
- .lando/fix-htaccess-file.sh
810
build:
911
- git submodule init
1012
- git submodule update

.lando/fix-htaccess-file.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#/bin/sh
2+
3+
# This loads an alternate htaccess file, `.htaccess-lando` if it is present.
4+
# The change is supposed to be made by core lando, but is failing. See:
5+
# https://github.com/lando/lando/issues/2277
6+
7+
echo "Checking for AccessFileName in /etc/apache2/apache2.conf..."
8+
if [ -e /etc/apache2/apache2.conf ]; then
9+
if ! grep -e 'AccessFileName .htaccess-lando .htaccess' /etc/apache2/apache2.conf >/dev/null; then
10+
# force apache to use the .htaccess-lando file
11+
sed -i 's/AccessFileName .htaccess/AccessFileName .htaccess-lando .htaccess/g' /etc/apache2/apache2.conf
12+
fi
13+
fi

0 commit comments

Comments
 (0)