RewriteEngine On # Ensure the rules only apply to the main domain and not subdomains RewriteCond %{HTTP_HOST} ^jamieparishooper\.com$ [NC] # Handle mobile users without exposing /m/ in the URL RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|iphone|ipod|opera mobile|palmos|webos" [NC] RewriteCond %{REQUEST_URI} !^/m/ [NC] RewriteCond %{HTTP_HOST} ^jamieparishooper\.com$ [NC] RewriteRule ^(.*)$ /m/$1 [L] # Handle desktop users without exposing /d/ in the URL RewriteCond %{HTTP_USER_AGENT} "!android|blackberry|googlebot-mobile|iemobile|iphone|ipod|opera mobile|palmos|webos" [NC] RewriteCond %{REQUEST_URI} !^/d/ [NC] RewriteCond %{HTTP_HOST} ^jamieparishooper\.com$ [NC] RewriteRule ^(.*)$ /d/$1 [L] # Redirect requests to the root domain to the appropriate subfolder without showing /d/ RewriteCond %{HTTP_HOST} ^jamieparishooper\.com$ [NC] RewriteCond %{REQUEST_URI} ^/$ RewriteRule ^$ /d/ [L]