Hi,
I'm still bashing my head against a wall with this. Almost nothing works!
My client really needs this to be up and running but I just can't make it work.
So, to re-iterate, in my .htaccess file, I have the following:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.sitename\.co.uk$ [NC]
RewriteRule ^(.*)$ http://www.sitename.co.uk/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.sitename.co.uk/ [R=301,L]
### RewriteRule Pattern Substitution [OptionalFlags]
RewriteRule ^ready-made-frames/?$ ready-made-frames.php [L] # Ready-made frames page # Works fine
RewriteRule ^ready-made-frames/([^/\.]+)/?$ frames.php?search=$1 [L] # Ready-made frames category page # Works fine
RewriteRule ^ready-made-frames/([^/\.]+)/([^/\.]+)/?$ frame-details.php?search=$2 [L] # Works fine
RewriteRule ^frames-by-size/?$ frames-by-size.php [L] # View frames by size page # Works fine
RewriteRule ^09search_results.php?search_KEYWORD=aluminium&search_RANGE=Frames&o=1&search=1+$ /ready-made-frames/aluminium/ [R=301,NC,L]
#NOTE: This is the simplest example of this rewrite I could find, but it just doesn't work.
Google has indexed loads of URLs like the one in the last RewriteRule above. If Google (or another search engine), sends a request to 09search_results.php?search_KEYWORD=aluminium&search_RANGE=Frames&o=1&search=1, what I need it to do is replace the URL in the browser address bar with /ready-made-frames/aluminium/
Simple, you'd think? But I just can't make it work.
If I change the last rewrite rule to RewriteRule ^09search_results.php /ready-made-frames/aluminium/ [R=301,NC,L] it works fine. But as soon as I put in any of the querystring, it stops working. The URL in the address bar stays resolutely at 09search_results.php?search_KEYWORD=aluminium&search_RANGE=Frames&o=1&search=1, rather than being replaced.
Please please if anyone can help, I'm getting really frustrated with this.
Thanks to AyKay47 and Requinix for suggesting solutions before, but they didn't work either :-(