I'd like to use .htaccess to redirect any non-www domain to its www equivalent, regardless of directory - I assume I need multiple RewriteRules
Goal:
domain.tld -> www.domain.tld
www.domain.tld -> www.domain.tld
domain.tld/directory -> www.domain.tld/directory
www.domain.tld -> www.domain.tld/directory
So far I have
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
... but all that does is redirect domain.tld -> www.domain.tld. It does not account for a directory. That is, domain.tld/directory does not redirect to www.domain.tld/directory; it just goes directly to domain.tld/directory
Perhaps I need a separate rewrite rule? I'm cool with that.
Any help is greatly appreciated