I want to redirect all domains from a specific directory to a new subdomain (invisibly).
e.g. example.com/literal/some/path/to/file.html
-> sub.example.com/literal/some/path/to/file.html
AND
www.example.com/literal/some/path/to/file.html
->
www.sub.example.com/literal/some/path/to/file.html
Where "literal" should be constant, and anything that comes after it is arbitrary.
I've tried things like
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com/literal
RewriteRule ^(.*)$ http://sub.example.com/$1 [L]
But I can't get all the options right. Any help appreciated.