I have a subdomain which has been indexed in Google. The pages (a WordPress development project) are no longer there, so I want Google to realise that. I figured that a 410 is the way to go, but rather than putting them on individual posts that no longer exist, I was thinking maybe it could be a catch-all for the entire folder.
Would that be possible and would it be a good idea?
In the subdirectory that this subdomain resolves to you could use the following mod_rewrite directive that returns a 410 Gone for all requests:
The
^matches all requests.-indicates no substitution. TheGflag results in a 410 Gone response being sent to the client (shorthand forR=410).The default Apache 410 response will be sent to the client - unless you have defined a custom error document.
Yes, this is a good idea in order to get Google to drop the URLs from its search results in the shortest time possible. You could also consider using Google's URL removal tool as well.