|
Hi. Ok, here's the setup: I'm using php and trying to use mod_rewrite to make all my pages SE friendly.
My old pages were in the format:
site.com/customize.php?shirt=BLAH
The way I have it setup now I have my links going here:
site.com/t-shirts/BLAH/
This is the rule I used and it works fine::
RewriteRule ^t-shirts/([a-zA-Z0-9_-]+)(/*)?(.*)?$ /customize.php?shirt=$1 [L]
The problem is I have incoming links pointed at my customize.php page so I'd like to do a 301 redirect (permanent) from the customize.php page to the new page which uses the rewrite (/t-shirts/BLAH/).
I'm pretty sure I need to use a RewriteCond to pull the query value and pass it but I'm not sure how to do it. My attempt was like this:
RewriteCond %{QUERY_STRING} shirt=([^&;]*)
RewriteRule ^customize.php$ /t-shirts/%1/ [R=301,L]
... but it always leads me to /t-shirts/THE_COMPLETE_QUERY
With:
RewriteRule ^customize.php$ /t-shirts/%1/ [R=301,L]
.. how do I make %1 just be the VALUE of 'shirt='?
Thanks!
|