skip to Main Content

Our company’s SEO expert asked me to set some particular pages to 410 – status gone.

I have searched about declaring 410 urls in .htaccess but I’m very confused, cause I don’t understand if I have to redirect google bots to another url or just make a statement (just that these urls are missing, and don’t search about them, they’re gone). I’m also confused about how to do that, cause I’ve seen many differect codes reffering to 410, and I don’t understand which one fits my case.

I think that the following code is what I need, but I’m not sure. Could you please check the following lines and tell me if they’re correct? Do they set these urls to 410-status-gone?

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
Redirect 410 /path_to_file/file1.html
Redirect 410 /path_to_file/file2.html
Redirect 410 /path_to_file/file3.html
</IfModule>

2

Answers


  1. You can use:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    
    RewriteRule ^path_to_file/(file1|file2|file3).html$ - [L,NC,G]
    
    </IfModule>
    

    Flag G (Gone) is equivalent of R=410.

    Login or Signup to reply.
  2. I wanted the same thing to do in my application. This is what I did in my .NET application.

    Just add below 2 lines

    HttpContext.Current.Response.StatusCode = System.Net.HttpStatusCode.Gone;
    HttpContext.Current.ApplicationInstance.CompleteRequest();

    Cheers

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search