I'm in the process of shutting down a site, and have replaced the old site with a single "nobody home" page at the root level of the site. Now I need to set up some redirection, so that any request to any part of the site, no matter how complicated, ends up at the root page.
I've tried what (I thought) ought to work: Creating an .htaccess
file containing:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://www.example.com/ [L,R=301,NE]
but it mostly fails: Requests to http://www.example.com
still get through, but https://www.example.com/doesnotexist.html
throws a 404. (If there was no redirection going on, this would be correct, since that page doesn't exist on the site, but that's the point of the redirection: I want this request to be sent to https://www.example.com
.)
Arggh. The answer to this is probably obvious to everyone but me; can anyone help out?
PS: I'm in a shared hosting situation, so I have to do this with a .htaccess
file rather than hacking a full Apache configuration file.