Just spent time to try redirecting the subdomain of a WPML translated website en.example.com to a subdirectory /en/ using htaccess.

You know why… :

Finally, I got it with cPanel “Redirect” feature. I’m so happy, I share the generated code, if it can helps, you’ll be happy too.

So :
RewriteEngine on
RewriteCond %{HTTP_HOST} ^en\.example\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.en\.example\.com$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ "https\:\/\/www\.example\.com\/en\/$1" [R=301,L]

You probably don’t need the lines 3-4-5, but I give everything… sort it 😉

Please, leave a small comment below if it helps you. Thanks !