0

I have an existing Apache httpd server. All of the existing virtual hosts have php landing pages (i.e., index.php). The new one, however, has a plain, old-fashioned, html landing page (i.e., index.html).

I can get the html landing page to come up if I explicitly specify it in the url, e.g., http://qux.baz.com/index.html (not the real URL).

But if I don't explicitly specify the landing page in the url, e.g., http://qux.baz.com, it immediately redirects to https://www.qux.baz.com, which fails.

I've tried putting a DirectoryIndex directive in the qux.baz.conf file; no effect, even after restarting httpd.

The only existing DirectoryIndex directive I've found anywhere is the one in php.conf. I tried adding "index.html" onto the end of it. Also no effect.

My new conf file looks like this (the URLs have been changed to protect the innocent):

<VirtualHost *:80>
ServerName qux.baz.com
ServerAlias corge.baz.com
DocumentRoot /var/www/html/test
ServerAdmin info@baz.com
<Directory /var/www/html/test>
AllowOverride All
</Directory>
# RewriteEngine on
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</VirtualHost>

(note that I've deliberately commented out everything to do with rewriting)

and the httpd -S output (again, URLs changed to protect the innocent) looks like

*:443                  is a NameVirtualHost
         default server www.foo.com (/etc/httpd/conf.d/foo-le-ssl.conf:2)
         port 443 namevhost www.foo.com (/etc/httpd/conf.d/foo-le-ssl.conf:2)
                 alias foo.com
         port 443 namevhost ip-172-32-29-49.ec2.internal (/etc/httpd/conf.d/ssl.conf:56)
         port 443 namevhost www.plugh.com (/etc/httpd/conf.d/plugh-le-ssl.conf:2)
                 alias plugh.com
         port 443 namevhost www.baz.com (/etc/httpd/conf.d/baz-le-ssl.conf:2)
                 alias baz.com
         port 443 namevhost www.bar.com (/etc/httpd/conf.d/bar-le-ssl.conf:2)
                 alias bar.com
*:80                   is a NameVirtualHost
         default server www.foo.com (/etc/httpd/conf.d/foo.conf:1)
         port 80 namevhost www.foo.com (/etc/httpd/conf.d/foo.conf:1)
                 alias foo.com
         port 80 namevhost www.plugh.com (/etc/httpd/conf.d/plugh.conf:1)
                 alias plugh.com
         port 80 namevhost www.baz.com (/etc/httpd/conf.d/baz.conf:1)
                 alias baz.com
         port 80 namevhost www.bar.com (/etc/httpd/conf.d/bar.conf:1)
                 alias bar.com
         port 80 namevhost qux.baz.com (/etc/httpd/conf.d/qux.baz.conf:1)
                 alias corge.baz.com
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/etc/httpd/logs/error_log"
Mutex authdigest-opaque: using_defaults
Mutex watchdog-callback: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex authdigest-client: using_defaults
Mutex lua-ivm-shm: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/run/httpd/" mechanism=default 
Mutex mpm-accept: using_defaults
Mutex cache-socache: using_defaults
PidFile: "/run/httpd/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="apache" id=48
Group: name="apache" id=48

I'm clearly doing something wrong here, but I have not the slightest idea what.

hbquikcomjamesl
  • 259
  • 2
  • 16

1 Answers1

0

I honestly can't believe this [profanity]!

My BROWSERS were doing this [profanity]!

They were remembering where they went when the virtual host for http://qux.baz.com didn't exist, or wasn't serving index.html by default, and they were [profanity] redirecting me to a nonexistent URL!

I don't suppose anybody knows of a way to tell a browser to never remember redirections?

hbquikcomjamesl
  • 259
  • 2
  • 16