Well, a conspicious silence on this subject suggests that maybe I should be talking to my hosting service instead ??
FWIW, I’ve been troubleshooting. If this isn’t obvious to anyone else out there already, the problem seems to be the .htaccess file rather than whatever WP does when you switch on permalinks.
As soon as I insert the .htaccess file in /blog/, all urls inside /blog get resolved to
https://foo.example.com/cgi-bin/tester
as soon as the actual link is submitted to the server.
This happens whether or not I ‘update permalink structure’. The server is running OSX using Apache.
If I delete the content in .htaccess then everything is fine. So htaccess is obviously working, but the server is stumbling over the instructions.
BTW, the .htaccess code is:
Options FollowSymlinks
RewriteEngine On
RewriteBase /blog/
RewriteRule ^category/(.*)/(feed|rdf|rss|rss2|atom)/?$ /blog/wp-feed.php?category_name=$1&feed=$2 [QSA]
RewriteRule ^category/?(.*) /blog/index.php?category_name=$1 [QSA]
RewriteRule ^author/(.*)/(feed|rdf|rss|rss2|atom)/?$ /blog/wp-feed.php?author_name=$1&feed=$2 [QSA]
RewriteRule ^author/?(.*) /blog/index.php?author_name=$1 [QSA]
RewriteRule ^([0-9]{4})/?([0-9]{1,2})?/?([0-9]{1,2})?/?([_0-9a-z-]+)?/?([0-9]+)?/?$ /blog/index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA]
RewriteRule ^([0-9]{4})/?([0-9]{1,2})/([0-9]{1,2})/([_0-9a-z-]+)/(feed|rdf|rss|rss2|atom)/?$ /blog/wp-feed.php?year=$1&monthnum=$2&day=$3&name=$4&feed=$5 [QSA]
RewriteRule ^([0-9]{4})/?([0-9]{1,2})/([0-9]{1,2})/([_0-9a-z-]+)/trackback/?$ /blog/wp-trackback.php?year=$1&monthnum=$2&day=$3&name=$4 [QSA]
RewriteRule ^feed/?([_0-9a-z-]+)?/?$ /blog/wp-feed.php?feed=$1 [QSA]
RewriteRule ^comments/feed/?([_0-9a-z-]+)?/?$ /blog/wp-feed.php?feed=$1&withcomments=1 [QSA]
And no, the ‘options FollowSymlinks’ makes no difference at this stage