Hello David,
I was using a lot of subdomains. I stopped using these subdomains. I have to many subdomains for removing manually. So i made a wildcard subdomain and redirect this one to my mainsite.
Now i want to remove all subdomains from google. So i places this in my htaccess:
RewriteCond %{HTTP_HOST} ^(.+)\.example\.nl$ [NC]
RewriteRule ^(.*)$ http://example.nl/$1 [L,R=301]
But do you know if it is possible to redirect like this with htaccess:
http://subdomain.example.nl/product/abs.html
to
http://example.nl/product/abs.html
So redirecting to the same product without subdomain before it?
Thanks Jan Roel
Hello Jan,
As far as I can tell that is how your rule should be working - ^(.*)$ matches the full request URI (after the hostname) e.g. "/product/abs.html" and then $1 appends this to the redirection host name. It might be however that you just require a RewriteBase in your wildcard subdomain's .htaccess - have a go with;
RewriteBase /
RewriteCond %{HTTP_HOST} ^(.+)\.example\.nl$ [NC]
RewriteRule ^(.*)$ http://example.nl/$1 [L,R=301]
Cheers,
David.
--
PriceTapestry.com