1
votes

I have a subdomain that used to be an ecommerce store but I have since removed it.

The problem is Google has 100's of these pages indexed but they are all resolving to 404.

I tried putting a 301 redirect in the .htaccess of the subdomain/folder but it only works for the subdomain. It's passing along the pages of the store to the root domain and since they don't exist, it's resulting in a 404 again.

I just want a redirect that will redirect ANY call to ANY subpage of the subdomain and send them to the main root.

Hope that makes sense but if not please ask and I'll try to clarify.

Steve

2
You can do this with PHP as well so that you will have more command over the scenarios. Check out this blog => phpjunkyard.com/tutorials/php-redirect.phpTalha Masood

2 Answers

0
votes

Try:

RedirectMatch 301 ^ http://main.domain.com/

The thing about using Redirect is that it virtually connects two "nodes", so if you do:

Redirect 301 / http://main.domain.com/

It connects the root of the subdomain to the root of the main domain, and passes along anything after the / as well.

0
votes

Easier than I thought :)

I'll put this here in case anybody else has the same need.

RedirectMatch 301 ^/ http://www.youdomain.com/a/page/if/needed

Just noticed Jon had said the same thing but I missed it because I was trying to figure it out for myself... thanks Jon!