I'm working on a site that only works if you type in www. Only the www subdomain has an A record. The bare/naked domain is unable to be given an A record. The naked domain can also not be given a DNS Alias. This means the site without "www" shows an error in your browser.
I'm trying to think through any creative solution that may solve this usability issue.
Would an htaccess rewrite rule such as:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
work in this scenario to force users to the www working site and to keep users from seeing an error in their browser?
I'm thinking it likely does NOT work because the htaccess file would only be accessed when users already typed in www (which has the A record). Is that thinking correct?
(Additional examples of htaccess code are in this thread) Redirect non-www to www in .htaccess
If this isn't a valid option, any other creative solutions that might work?