D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] htaccess regex question

 

On Mon, 20 Aug 2007 11:42:25 +0100, Martijn
<sweetwatergeek@xxxxxxxxxxxxxx> wrote:

>On 8/19/07, Dave Morgan <morgadave@xxxxxxxxxxxxxx> wrote:
>> My current .htaccess file -
>>
>> Redirect 301 /topmenu.html /topmenu.php
>> Redirect 301 /books-az.html /books.php
>> Redirect 301 /goodsinwards.html /gallery2/main.php/v/4801pics/
>> Redirectmatch 410 ^(/gallery/)*
>>
>> The top three lines work,  but the bottom line does not.
>>
>> What should I have put on the bottom line to get it to match all
>> paths starting /gallery/ ?
>
>I would think -but haven't tested it- that
>RedirectMatch 410 ^/gallery/.*
>should work. (And quite probably you can leave out the .* as well.)
>
>My big book on Apache is a few hundred miles from here, so I can't
>check it now, but I think Apache directives are case-sensitive; hence
>the capital 'M'. Moreover, the * in your regex means that it matches
>the preceding block (i.e. "/gallery/" without the quotes) zero or more
>times. Which, I think, it would always do.
>
>It is, by the way, a very neat way of telling browsers and crawlers
>that your page has been removed permanently. Just removing the
>directory would give 404 errors, which would mean "I have no idea what
>happened to these files, but I can't find them right now". Crawlers
>are probably programmed to keep checking for quite a while in such
>cases (and fair enough, you don't want your pages to be de-index just
>because the moment the crawler visited your site, you had accidentally
>removed a file).
>http://www.checkupdown.com/status/E410.html
>
>Martijn.

thanks Martin, (and the rest of this thread below)

It turns out RedirectMatch 410 /gallery/* was all I needed. You
are right that the web crawlers will never give up, even after
many months' of 404's, And I want them to forget all about these
old links.

<embarressed>
the problem turned out to be that allowoverride was set to 'none'
in my site config, so it was ignoring the .htaccess file :-/
</embarressed>

The only problem is that I am forced to put http://morgad.co.uk/
at the start of all redirected addresses otherwise I get internal
server errors, but perhaps it is time to start retiring the
www.morgad.no-ip address anyway (they both point to same Ip
address and web pages)

best regards
Dave
-- 
http://www.morgad.co.uk/index.html 
DP: http://www.pgdp.net   NTP: http://www.pool.ntp.org
L&B: http://www.lynton-rail.co.uk

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html