Apache Version 2.4.46 PHP 7.2 using FPM The following rule/cond set looks for a path specification after the domain. if one exists, rewrite with "dir/" and the whole path string found: RewriteCond %{HTTP_HOST} "^(?:www\.)?mydomain\.com$" RewriteCond $1 "!^\/?$" RewriteRule ^(.*)$ /dir/$1 [L,NC] However, the url path parsing / parameter passing function is not working consistently, functioning differently if a subdomain is present. For example, a php script, index.php uses param1 if set. If the initial url is the following: https://www.mydomain.com/test/?param1=foo param1 is passed properly, and the index.php script receives it in $_REQUEST If url is: https://mydomain.com/test/?param1=foo The parameter is NOT passed to index.php. As a side note: the following url encoded format DOES pass the paramter correctly when a subdomain is missing: https://mydomain.com/test/?¶m1=foo