[development] Can .htaccess discard part of a path?

Jennifer Hodgdon yahgrp at poplarware.com
Tue Nov 10 20:32:56 UTC 2009


Nancy Wichmann wrote:
> I put this in there already    
RewriteRule ^cgi-bin/printOriginal.pl/$ 
http://www.example.com [R=301,L]
> And I am still seeing these come through to the Drupal log.

You said the URLs that were problems looked like this:

http://www.example.com/index.php?q=cgi-bin/printOriginal.pl&file=/alpha/beta/gamma/rage_prevention.shtml

The regular expression above ends in $,  which is the regexp special 
character meaning "end of the string/line". So it would only match a 
URL that ended with "printOriginal.pl/". You need something after that 
to match the rest of the URL... Something like:

^cgi-bin/printOriginal.pl/.*

Might work a bit better... (Caveat: I'm not an expert on Apache 
.htaccess redirects either.)

    -- Jennifer

-- 
Jennifer Hodgdon * Poplar ProductivityWare
www.poplarware.com
Drupal, WordPress, and custom Web programming



More information about the development mailing list