2

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?

MrWhite
  • 43,179
  • 8
  • 60
  • 84
ask
  • 25
  • 6

1 Answers1

0

In the subdirectory that this subdomain resolves to you could use the following mod_rewrite directive that returns a 410 Gone for all requests:

RewriteEngine On

RewriteRule ^ - [G]

The ^ matches all requests. - indicates no substitution. The G flag results in a 410 Gone response being sent to the client (shorthand for R=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.

MrWhite
  • 43,179
  • 8
  • 60
  • 84
  • Thanks a lot! I've added that now and it now shows pages with **Gone. The requested resource is no longer available on this server and there is no forwarding address. Please remove all references to this resource for all the pages.** Is it a good idea to combine this with the URL removal tool in your experience? – ask Jan 14 '20 at 18:58
  • You can certainly combine this with the URL removal tool if you wish - this can speed up the process. The URL removal tool is "temporary", but if your URLs are now returning a 4xx status then they won't come back. – MrWhite Jan 14 '20 at 19:37
  • 1
    Thanks a lot, really appreciated. – ask Jan 14 '20 at 19:49