On Mon, Apr 20, 2009 at 3:36 PM, David Spencer <span dir="ltr"><<a href="mailto:spencer@pageweavers.com">spencer@pageweavers.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I've killed the better part of the morning and this afternon trying to<br>
figure out this use of Apache's mod_rewrite.</blockquote><div><br>Welcome to mod_rewrite. There's a logging facility that can create a log of which rules were tried, but it doesn't help in this case where you only have one rule. <br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
RewriteEngine On<br>
RewriteRule ^/?product-([A-Za-z0-9-]+)\.php$ product.php?name=$1<br>
[ R=301,L]<br>
</blockquote><div><br>You did a gread job here, but ...<br><br>1) No spaces in the [] at the end of the line, so you want [R=301,L]<br><br>2) I found I needed to add this option also:<br>Options +SymLinksIfOwnerMatch<br>
<br>3) You almost certainly also want QSA (query string append), making it [R=301,L,QSA] at the end of the line. This will add the name parameter to whatever other parameters were sent, instead of dropping the original parameters:<br>
<br> product-a.php?quantity=4 -> product.php?name=a&quantity=4<br><br>You can check Apache's error_log if this still isn't working for hints.<br><br>Harold<br></div></div>