Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite help

         

catchmeifucan

7:00 pm on Mar 17, 2005 (gmt 0)

10+ Year Member



Hi, Steve,

I am checking my SERPs on Google and found my site map page is producing some URLs like

[mysite.com...]

which, I think should be 301 redirect to

[mysite.com...]

how do I write a rule for this redirect?

would this code below work?

RewriteCond %{QUERY_STRING} ^(.+)name=[0-9a-z]+&(.+)$ [NC]
RewriteRule (.*) $1?%1&%2 [R=301,L]

and if I need to rewrite this

[mysite.com...]

to

[mysite.com...]

should the code be

RewriteCond %{QUERY_STRING} ^(.+)sams=[0-9a-z]+&(.+)$ [NC]
RewriteRule (.*) $1?%1&%2 [R=301,L]

sitz

1:52 am on Mar 18, 2005 (gmt 0)

10+ Year Member



Unless that HTML file is performing an action based on that query string, there isn't really any point in installing a RewriteRule for this; an internal rewrite (what's /generally/ used) will simply expend CPU cycles to display exactly the same content, and an external redirect (302) will cause the user to re-request a page with a shorter URL which returns...exactly the same content they would have gotten otherwise. I agree that the URL you posted is long and obnoxious, but I'd concentrate on getting your site map cleaned up so that when Google re-indexes your site, the URLs are correct.