I am in the process of changing the architecture of a site from: subdomain1.domain.co.uk/product_a subdomain2.domain.co.uk/product_b subdomain3.domain.co.uk/product_c to: www.newdomain.co.uk/brand_a/product_a www.newdomain.co.uk/brand_b/product_b www.newdomain.co.uk/brand_c/product_c Basically, the subdomains are brand names, I have always hated the architecture so changing to a better subfolder system. When I go live I know I need to use .htaccess for my permanent redirections, but for the life of me I can't figure out how it's written, anyone any ideas? It's a WordPress/woo site. Thanks in advance
This will redirect subdomain1.domain.co.uk/product_a to www.newdomain.co.uk/brand_a/product_a RewriteEngine on RewriteCond %{HTTP_HOST} ^subdomain1.domain.co.uk RewriteRule ^(.*)$ http://www.newdomain.co.uk/brand_a/$1 [L,NC,QSA] Code (markup): A more general rule if the subdomain and the subdirectory are sharing the same name: RewriteEngine on RewriteCond %{HTTP_HOST} ^(.*)\.domain\.co\.uk RewriteRule ^(.*)$ http://www.newdomain.co.uk/%1/$1 [L,NC,QSA] Code (markup):