Repository navigation
Open
Description
I'm trying to override the .htaccess file as instructed in https://docs.lando.dev/config/apache.html#configuration. Adding .htaccess-lando next to the Drupal root .htaccess file doesn't do anything. I have tried rebuilding and also tried adding the custom httpd.conf file taken from https://github.com/lando/lando/tree/master/plugins/lando-services/services/apache. Any ideas how I can get this working?
Running Lando v3.0.3 on Windows 10.
name: thingymajig
recipe: drupal7
config:
php: '7.2'
via: apache
webroot: web
database: mariadb
drush: ^8
xdebug: false
config:
php: .lando/.lando.php.ini
database: .lando/.lando.mysql.cnf
server: .lando/httpd.conf
vhosts: .lando/default.conf
proxy:
appserver:
- thingymajig.lndo.site
- www.thingymajig.lndo.site
mailhog:
- mail.thingymajig.lndo.site
pma:
- pma.thingymajig.lndo.site
adminer:
- adminer.thingymajig.lndo.site
services:
database:
creds:
database: thingymajig
user: thingymabob
password: easylike123
appserver:
overrides:
environment:
# Support debugging Drush with XDEBUG.
PHP_IDE_CONFIG: "serverName=appserver"
mailhog:
type: mailhog
hogfrom:
- appserver
portforward: true
pma:
type: phpmyadmin
hosts:
- database
adminer:
type: compose
services:
image: dehy/adminer
command: /bin/s6-svscan /etc/services.d
portforward: true
tooling:
xon:
service: appserver
description: Enable xdebug for apache.
cmd: "docker-php-ext-enable xdebug && /etc/init.d/apache2 reload"
user: root
xoff:
service: appserver
description: Disable xdebug for apache.
cmd: "rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && /etc/init.d/apache2 reload"
user: root
excludes:
- .idea
- .git

Activity
rabauss commentedon May 22, 2020
How does your
httpd.conflook like?I guess, it should contain the following line like in the example:
https://github.com/lando/lando/blob/3802a60012fa1938ff3cf2f647c4ad7e1baf72a1/examples/apache/config/httpd.conf#L455
EDIT: I see you took them from the services. Could be a bug in the config - but I've never use that feature before.
web-assistant commentedon May 22, 2020
@rabauss I changed the
httpd.confto the one in the link you provided but still get the same issue. The docs say that the override should work with thehttpd.confshipped with Lando, though if I have the.htaccess-landofile with no customhttpd.confit still doesn't work. I'm rebuilding Lando each time.hanoii commentedon May 24, 2020
Yes, this is not working for me either. Looking at the
/etc/apache2/apache2.confinside the container it doesn't have .htaccess-lando on itanacolautti commentedon Jun 2, 2020
Hi everyone!
While the experts figure this out (I wish I could help, but actually I know very little of about the subject) I have a temporal fix for anyone who might need this right away.
I was inspired by the issue that enabled this feature to begin with, I tried actually applying their code and it didn't work for me.
This variation of their code did, though:
I'm replacing the line in my Apache service that calls my client's .htaccess and calling the file .htaccess-lando instead.
I know this is just temporary, until someone fixes this for real, but in took me a few hours to get this working and I thought I could spare them for someone else.
Just remember to add this code to a script, and call it from your .lando.yml file at the services key like this:
Keep being awesome!
stale commentedon Apr 27, 2021
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions and please check out this if you are wondering why we auto close issues.
f-liva commentedon Sep 10, 2021
When will this hotfix be implemented natively?
stale commentedon Mar 30, 2022
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions and please check out this if you are wondering why we auto close issues.
reynoldsalec commentedon May 5, 2022
...and this is still totally an issue. Taking a look at this after some folks mentioned it on Slack.
reynoldsalec commentedon May 23, 2022
Ok, so in some ways the "root issue" here is one of documentation.
The Lando Apache service accepts a
.htaccess-landofile just fine, but virtually no one uses the standalone Lando Apache service. Typically Lando users are using a WordPress/Drupal recipe that leverages Lando's PHP service, and that service actually uses different Dockerfiles to generate the Apache server, which do not make the changes tohttpd.confnecessary to read the.htaccess-landofile.That said, I think we've had enough consistent interest/confusion in this feature that it should be added to the PHP service.
I'm moving this ticket to the lando/php project, steps for implementation are to...
httpd.confwith the lineAccessFileName .htaccess-lando .htaccess/etc/apache2/apache2.conf)[-].htaccess-lando not overriding .htaccess[/-][+]Allow a .htaccess-lando to override .htaccess[/+]reynoldsalec commentedon May 23, 2022
...also noting that when we re-do the PHP service, we should have it consume the Lando Apache service.
yorkshire-pudding commentedon Sep 1, 2022
Thanks @anacolautti for documenting the workaround.
It works a treat.