Configtest error AH00526: Syntax error in httpd-autoindex.conf

apachecatalinaterminalwebserver

I've been using the tutorials here as well as here in order to host a web page using Apache on macOS Catalina Version 10.15.1. The problem was that I couldn't access the localhost and kept getting a 404 error.

Upon entering the line sudo /usr/sbin/apachectl configtest in the terminal, I get the following error message:

AH00526: Syntax error on line 21 of /private/etc/apache2/extra/httpd-autoindex.conf:
Invalid command 'Alias', perhaps misspelled or defined by a module not included in the server configuration.

This was the line that was giving me trouble:

Alias /icons/ "/usr/share/apache2/icons/"

Best Answer

TL;DR I turned the offending line into a comment by adding a ˋ#ˋ in the first column and restarted Apache.


To fix this, I followed the Youtube tutorial and opened up the file "httpd-autoindex.conf" using Finder and navigated down to line 21 which has the error. It reads Alias /icons/ "/usr/share/httpd/icons/".

Then I found this tutorial by just searching the erroring line in the file on Google. I followed the instructions up until the fourth step because upon trying that line in the terminal I get the message "-bash: service: command not found". So then I simply restarted the apache web server by entering sudo apachectl restart.

Finally, I tried writing sudo /usr/sbin/apachectl configtest and received the "Syntax OK" message, so I went back to the final step in the first tutorial. I entered

sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist

At last, I type "localhost" into the search bar, hit enter, and get the "It works!" message.