I’m attempting to set a 301 redirect in .htaccess
The ‘dir’ is a set value so it’s not any directory, but the one specified only. Here’s what I have —
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.com/dir$ [NC]
RewriteRule ^(.*) http://dir.domain.com/$1 [L,R=301]
HTTP_POST is not a valid choice. You can even make this more robust, but this should limit it to the specific domain by having two conditions. One for the host header, and the other for sub-folder.