My new site, product of just a few days, works perfectly with the hugo server. Switched back to Apache, and navigation is busted.
This is a simple blog site set up basically according to the Hugo howto [1]. Content structure is:
/apple
/banana
/currant
about.md
I added a couple of taxonomies, some templates etc., and a menu as documented here. This menu has urls “/apple” , “/banana”, “/currant”, “/about”, “/tags” and “/authors”.
That’s as the links are in the HTML. As seen in the brower, the domain name is prepended: “http://localhost:1313/apple”, etc…
So, I quit out of the Hugo server and fell back to apache. My web projects are in /srv/www
with one subdirectory per site - so /srv/www/site1
, etc…
And there’s an Apache VirtualHost for each site/project.
At first the browser was pointed to just /srv/www/hugo
and didn’t find an index of course, Hugo puts the generated site in its /public
, right? So I corrected that, and now the VH now looks like this:
<VirtualHost *:8087>
#ServerName example.com
#ServerAlias www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /srv/www/hugo/public
LogLevel info warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
(VH’s just like this work fine with other frameworks, some with rewrite rules, etc.)
Now the index page comes up OK, suppose I click the ‘apple’ link - this goes to an apache-generated list of contents under /apple
(instead of the nicely templated page in the correct site). One of the listed files is index.html
, but if I click on that, it’s interpreted as http://localhost:8087/index.html
instead of http://localhost:8087/apple/index.html
, and the client is back on the home page.
The block in apache config looks as so:
<Directory /srv/www/hugo>
Options Indexes FollowSymLinks MultiViews
AddDefaultCharset UTF-8
AllowOverride All
Require all granted
</Directory>
Those are basically defaults. How can I make Apache do whatever magic the Hugo server is doing to make the site work?