Forum Moderators: phranque

Message Too Old, No Replies

What is the correct syntax for a removed subsite?

I want the spiders to know it is gone forever

         

Wizcrafts

4:23 am on Sep 5, 2003 (gmt 0)

10+ Year Member



Q1:
I am about to remove an entire folder from my webspace, which includes long-term indexed pages. How do I specify that any file, including the index.html file, is permanantly gone and not just unavailable? I want to include this in my master .htaccess. The directory in question is named "leatherworks" and had various .html files inside it, all indexed.

Q2:
I also need to tell the spiders that other individual files in the main directory have been removed or renamed, and that they should stop searching for them. For instance, "regsave2.html" has been renamed to "regsave.html" for about 6 months, but every now and then I see a SE looking for the old file.

Thanks in advance

DaveAtIFG

7:37 pm on Sep 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You should return a 404 response code for any files and or directories that have been removed. For any moved or renamed files, a 301 response is appropriate. W3C reference [w3.org]

jdMorgan

7:41 pm on Sep 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For HTTP/1.1, you can return 410-Gone status, with a fallback to 404-Not Found for HTTP/1.0 requests.

Jim

DaveAtIFG

7:48 pm on Sep 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Jim, I couldn't locate the 1.1 status codes. Got a URL? :)

jdMorgan

8:02 pm on Sep 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, just posted elsewhere...

HTTP/1.1 Response: [w3.org...]

Jim

Wizcrafts

8:26 pm on Sep 5, 2003 (gmt 0)

10+ Year Member



Thanks Dave and JD for the advise and link to Wc3.
Unfortunately, I am unable to find anything there that will help me to include these codes in my .htaccess file, which is how I intend to deal with removed or renamed files.

Where should I go for info on 410s in .htaccess?

jdMorgan

9:29 pm on Sep 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Wizcrafts,

The info is spread around in the documentation, so here's an example. This will respond to requests for several obsolete html and php files with a 410-Gone if the request is HTTP/1.1 or above. Otherwise, the server's default 404 handler will be invoked.


# Respond with 410-Gone status to HTTP/1.1+ requests for removed resources.
# HTTP/1.0 requests will "fall through" and invoke default server 404 handling.
RewriteCond %{THE_REQUEST} ^[^\ ]+\ [^\ ]+\ HTTP/(1\.[1-9]¦[2-9]\.[0-9])
RewriteCond %{REQUEST_URI} ^/(edsel¦victrola¦icebox¦bellbottoms)\.html$ [OR]
RewriteCond %{REQUEST_URI} ^/(corvair¦pinto)\.php$
RewriteRule .* - [G]

Note that the "¦" symbol (here meaning "or") is modified by posting on this forum; Substitute a solid vertical pipe character from your keyboard before attempting to use this code.

Ref: Introduction to mod_rewrite [webmasterworld.com]

Jim

Wizcrafts

9:36 pm on Sep 5, 2003 (gmt 0)

10+ Year Member



Thanx Jim. At least I now have a starting point to jump off from. I imagined that there would be something like that, but had nothing to go by. I did a search of WebmasterWorld and saw very few refs to gone directives.

Wiz