I'm tearing my hair out over this one - I imagine the answer is pretty simple but I just can't work it out. What I want to do is 301 redirect URLs like /index.php?t=view&uin=777 to /777.html where 777 is an integer. Can anyone point me in the right direction?
Have you tried something like this? RewriteRule ^index.php?t=view&uin=([0-9]+)$ /$1.html [R=301,L] The exact syntax may very but the general idea should work, I believe
Thanks for you help, but yep I've tried that and it has no effect. I think it is the ? that is causing the problem. From what I've found from searches it seems that {QUERY_STRING} needs to be put in there somewhere.
Hmm, I've never dealt with the {QUERY_STRING}. A quick search turned up in http://womencentral.net/rewriting-url.html which could be helpful
RewriteCond %{QUERY_STRING} t=view RewriteCond %{QUERY_STRING} uin=([0-9]+) RewriteRule ^index.php$ %1.html? [R=302,L]
Anyone have an answer to this? I am trying to figure out how to do a 301 with a url like www.domain.com/?r=5 I want to 301 that to the document root.
Any reason you can't just write index.php to read in the parameters and actually send the 301 header itself?