Forum Moderators: phranque

Message Too Old, No Replies

Proper syntax for returning a 410

         

Marcia

5:13 am on Dec 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Still need to get the proper syntax

[webmasterworld.com...]

If you are hosted on a name-based virtual server, this is a non-issue, since your site cannot be accessed at all by a true HTTP/1.0 client that does not send the HTTP_HOST header. Therefore, no conditional checking is needed, and you may use mod_alias or unconditional mod_rewrite code to return a 410 response.

I'm hosted on name-based virtual server so no conditional checking is done, so what is the correct exact way to return a 410 in .htaccess using either mod_rewrite or mod_alias? (preferably the latter).

jdMorgan

5:56 am on Dec 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mod_alias:

Redirect 410 /previous-local-URL-path-to-removed-file

or, more specific and potentially safer, since it can use a regular-expressions exact-match instead of prefix-matching:

RedirectMatch 410 ^/previous-local-URL-path-to-removed-file$

mod_rewrite in .htaccess:

RewriteRule ^previous-local-URL-path-to-removed-file$ - [G]

mod_rewrite in server config:

RewriteRule ^/previous-local-URL-path-to-removed-file$ - [G]

The local URL-path for a page at "www.example.com/bar.html" would be "bar.html" for the purposes of the code snippets above.

Jim

Marcia

7:03 am on Dec 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you, Jim.

For some that I *really* want left alone altogether by a certain engine, I've decided to nuke some pages and password protect the whole directory.