<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Nancy,<div><br></div><div>Your existing rewrite rules do nothing to match your QUERY_STRING. You need a combination of matching the REQUEST_URI and QUERY_STRING.</div><div><br></div><div>I would suggest the following as a starting point *before* the standard drupal rewrite rules.</div><div><br></div><div><div>RewriteCond %{REQUEST_URI} ^/cgi-bin/printOriginal.pl$</div><div>RewriteCond %{QUERY_STRING} ^file=(.*)$</div><div>RewriteRule ^(.*)$ %1? [R=301,L]</div><div><br></div><div>You may need to adjust the RewriteRule line to</div><div><br></div><div>RewriteRule ^(.*)$ /PATH/TO/LEGACY/FILESDIR/%1? [R=301,L]</div><div><br></div><div>That way if a user requests:</div><div><a href="http://www.example.com/cgi-bin/printOriginal.pl?file=/foo/bar.shtml">http://www.example.com/cgi-bin/printOriginal.pl?file=/foo/bar.shtml</a></div><div><br></div><div>They should be redirected with a 301 (permanently moved) to:</div><div><a href="http://www.example.com/foo/bar.shtml">http://www.example.com/foo/bar.shtml</a></div><div><br></div><div>The key here is that filepath and files are matched via REQUEST_URI, but any parameters passed must be matched via QUERY_STRING. Also, the QUERY_STRING regex may need to be adjusted appropriately based on your incoming requests. (eg. if more than 'file' appears in the parameter list)</div><div><br></div><div>I suggest using wget or similar to test your 301's as you write them as it will spit out the 301 if you trigger one, and show you the rewritten URL client side. This is useful for debugging the corresponding regex's.</div><div><br></div><div>I didn't test any of the above so I hope that helps get you started,</div><div><br></div><div>Jeff</div><div><br></div><div>PS. the 'regular' in regular expression is a reference to regular languages: <a href="http://en.wikipedia.org/wiki/Regular_language">http://en.wikipedia.org/wiki/Regular_language</a></div><div><br></div><div><br></div><div><div>On Nov 10, 2009, at 11:55 AM, Nancy Wichmann wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div bgcolor="white" lang="EN-US" link="blue" vlink="purple"><div class="Section1"><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "><span style="font-size: 12pt; font-family: Arial, sans-serif; color: rgb(31, 73, 125); ">Wow, how did you know about MomsTeam (now YouthSportsParents)?<o:p></o:p></span></div><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "><span style="font-size: 12pt; font-family: Arial, sans-serif; color: rgb(31, 73, 125); "><o:p> </o:p></span></div><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "><span style="font-size: 12pt; font-family: Arial, sans-serif; color: rgb(31, 73, 125); ">I put this in there already </span><span style="font-size: 12pt; font-family: 'Courier New'; color: black; ">RewriteRule ^cgi-bin/printOriginal.pl/$<span class="Apple-converted-space"> </span><a href="http://www.youthsportsparents.com" style="color: blue; text-decoration: underline; ">http://www.youthsportsparents.com</a>[R=301,L]</span><span style="font-size: 12pt; font-family: 'Courier New'; color: rgb(31, 73, 125); "><o:p></o:p></span></div><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "><span style="font-size: 12pt; font-family: Arial, sans-serif; color: rgb(31, 73, 125); ">And I am still seeing these come through to the Drupal log.<o:p></o:p></span></div><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "><span style="font-size: 12pt; font-family: Arial, sans-serif; color: rgb(31, 73, 125); "><o:p> </o:p></span></div><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "><span style="font-size: 12pt; font-family: Arial, sans-serif; color: rgb(31, 73, 125); ">There might be a clue in RewriteRule<span class="Apple-converted-space"> </span></span><span style="font-size: 12pt; font-family: 'Courier New'; color: black; ">^alpha/sports/(.*)<span class="Apple-converted-space"> </span><a href="http://www.youthsportsparents.com/sports/$1" style="color: blue; text-decoration: underline; ">http://www.youthsportsparents.com/sports/$1</a>[R=301,L]</span><span style="font-size: 12pt; font-family: Arial, sans-serif; color: rgb(31, 73, 125); "><span class="Apple-converted-space"> </span>if I really understood regular [sic] expressions.<o:p></o:p></span></div><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "><span style="font-size: 12pt; font-family: Arial, sans-serif; color: rgb(31, 73, 125); "><o:p> </o:p></span></div><div><div><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "><span style="font-size: 14pt; font-family: 'Comic Sans MS'; color: fuchsia; ">Nancy E. Wichmann, PMP<span class="Apple-converted-space"> </span></span><span style="color: rgb(31, 73, 125); "> <o:p></o:p></span></div></div><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "><span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(31, 73, 125); ">Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr</span><span style="font-size: 10pt; font-family: Arial, sans-serif; color: rgb(31, 73, 125); ">.</span><span style="color: rgb(31, 73, 125); "><o:p></o:p></span></div></div><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "><span style="font-size: 12pt; font-family: Arial, sans-serif; color: rgb(31, 73, 125); "><o:p> </o:p></span></div><div><div style="border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-top-style: solid; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding-top: 3pt; padding-right: 0in; padding-bottom: 0in; padding-left: 0in; position: static; z-index: auto; "><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "><b><span style="font-size: 10pt; font-family: Tahoma, sans-serif; color: windowtext; ">From:</span></b><span style="font-size: 10pt; font-family: Tahoma, sans-serif; color: windowtext; "><span class="Apple-converted-space"> </span><a href="mailto:development-bounces@drupal.org" style="color: blue; text-decoration: underline; ">development-bounces@drupal.org</a><span class="Apple-converted-space"> </span>[<a href="mailto:development-bounces@drupal.org" style="color: blue; text-decoration: underline; ">mailto:development-bounces@drupal.org</a>]<span class="Apple-converted-space"> </span><b>On Behalf Of<span class="Apple-converted-space"> </span></b>Seth Freach<br><b>Sent:</b><span class="Apple-converted-space"> </span>Tuesday, November 10, 2009 11:26 AM<br><b>To:</b><span class="Apple-converted-space"> </span><a href="mailto:development@drupal.org" style="color: blue; text-decoration: underline; ">development@drupal.org</a><br><b>Subject:</b><span class="Apple-converted-space"> </span>Re: [development] Can .htaccess discard part of a path?<o:p></o:p></span></div></div></div><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "><o:p> </o:p></div><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; ">Nancy,<br><br>I'm assuming this is a leftover from the moms team site? The incoming requests are coming from the fact that Google appears to have lots of these links in its index still to these URLs and sites which still link to these URLs.<br><br>Instead of a rewrite, I'd suggest a a response code 301 redirect. This will be more Google friendly.<br><br>look in the default .htaccess file for the (commented out by default) lines that deal with www. redirection (ie, you always want people to see "www" or never do, regardless of how they access the site.) Using those patterns should help show you how to redirect to the same content but without the "<span style="font-family: 'Courier New'; ">cgi-bin/printOriginal.pl&file=/</span>"<br><br>Seth<br><br><br>Nancy Wichmann wrote:<o:p></o:p></div><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "><span style="font-size: 10pt; font-family: Arial, sans-serif; ">I am getting lots of requests like this:</span><o:p></o:p></div><p class="MsoNormal" style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 5pt; "><span style="font-size: 12pt; font-family: 'Courier New'; "><a href="http://www.example.com/index.php?q=cgi-bin/printOriginal.pl&file=/alpha/beta/gamma/rage_prevention.shtml" style="color: blue; text-decoration: underline; ">http://www.example.com/index.php?q=cgi-bin/printOriginal.pl&file=/alpha/beta/gamma/rage_prevention.shtml</a></span><o:p></o:p></p><p class="MsoNormal" style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 5pt; "><span style="font-size: 12pt; font-family: 'Times New Roman', serif; ">The file argument is a valid page on our old site and is itself redirected with a ReWriteRule in .htaccess. However, cgi-bin/printOriginal.pl does not exist and I have no idea what it was supposed to do (well, I can guess print the page). We get lots of these requests for different pages. I have tried a simple rewrite rule and a URL alias to prevent the 404 processing, but neither has fixed it.</span><o:p></o:p></p><p class="MsoNormal" style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 5pt; "><span style="font-size: 12pt; font-family: 'Times New Roman', serif; ">Is it possible to design a rewriterule that essentially discards the "cgi-bin/printOriginal.pl" and just serves up the requested page (well, after its own rewrite rule has worked)? So this would become</span><o:p></o:p></p><p class="MsoNormal" style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 5pt; "><span style="font-size: 12pt; font-family: 'Courier New'; "><a href="http://www.example.com/index.php/alpha/beta/gamma/rage_prevention.shtml" style="color: blue; text-decoration: underline; ">http://www.example.com/index.php/alpha/beta/gamma/rage_prevention.shtml</a></span><o:p></o:p></p><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "><span style="font-size: 12pt; font-family: Arial, sans-serif; "> </span><o:p></o:p></div><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "><span style="font-size: 12pt; font-family: Arial, sans-serif; "> </span><o:p></o:p></div><div><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "><span style="font-size: 14pt; font-family: 'Comic Sans MS'; color: fuchsia; ">Nancy E. Wichmann, PMP</span><o:p></o:p></div></div><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "><span style="font-size: 10pt; font-family: 'Courier New'; ">Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr</span><span style="font-size: 10pt; font-family: Arial, sans-serif; ">.</span><o:p></o:p></div><div style="margin-right: 0in; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; color: black; margin-top: 0in; margin-bottom: 0.0001pt; "> <o:p></o:p></div><p style="margin-right: 0in; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; color: black; "><span style="font-size: 10pt; font-family: Arial, sans-serif; color: windowtext; ">No virus found in this incoming message.<br>Checked by AVG -<span class="Apple-converted-space"> </span><a href="http://www.avg.com" style="color: blue; text-decoration: underline; ">www.avg.com</a><br>Version: 9.0.704 / Virus Database: 270.14.59/2494 - Release Date: 11/10/09 02:38:00</span><span style="color: windowtext; "><o:p></o:p></span></p></div></div></blockquote></div><br></div></body></html>