So I'm transferring a sold site to a client's host. Apparently on bluehost, creating an add on domain also creates a subdomain on your primary domain with a duplicate version of your entire site. I believe its a cpanel issue not a host specific thing, but all the hosting providers I've used in the past had things setup to avoid this SEO nightmare.
I used a 301 redirect so that addondomain.primarydomain.com goes to addondomain.com, but I'm not really sure how to make it so that addondomain.primarydomain.com/page1.php goes to addondomain.com/page1.php. I've tried, but my mod rewrite knowledge is pretty limited.
It seems like the simple solution would be to just 404 the whole subdomain, since I don't really care if it redirects. I tried numerous variations of the following code, but none of it seems to work.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^addondomain.primarydomain.com(.*)$ [NC]
RewriteCond %{REQUEST_URI} ^/(.*)$
RewriteRule ^(.*)$ - [L,R=404]
I'm not really sure why this doesn't work. Possibly because I'm retarded, but I did get the following to work to 404 the contents of primarydomain.com/addondomain.com/
RewriteCond %{HTTP_HOST} ^(www.)?primarydomain.com$ [NC]
RewriteCond %{REQUEST_URI} ^/addondomain.com/(.*)$
RewriteRule ^(.*)$ - [L,R=404]
I would really appreciate it if someone could point me in the right direction. Why does the latter work when the former doesn't? Also, flaming is more than welcome, especially if it comes with a solution. Thanks.
I used a 301 redirect so that addondomain.primarydomain.com goes to addondomain.com, but I'm not really sure how to make it so that addondomain.primarydomain.com/page1.php goes to addondomain.com/page1.php. I've tried, but my mod rewrite knowledge is pretty limited.
It seems like the simple solution would be to just 404 the whole subdomain, since I don't really care if it redirects. I tried numerous variations of the following code, but none of it seems to work.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^addondomain.primarydomain.com(.*)$ [NC]
RewriteCond %{REQUEST_URI} ^/(.*)$
RewriteRule ^(.*)$ - [L,R=404]
I'm not really sure why this doesn't work. Possibly because I'm retarded, but I did get the following to work to 404 the contents of primarydomain.com/addondomain.com/
RewriteCond %{HTTP_HOST} ^(www.)?primarydomain.com$ [NC]
RewriteCond %{REQUEST_URI} ^/addondomain.com/(.*)$
RewriteRule ^(.*)$ - [L,R=404]
I would really appreciate it if someone could point me in the right direction. Why does the latter work when the former doesn't? Also, flaming is more than welcome, especially if it comes with a solution. Thanks.