Hey guys, I am using the following mod_rewrite rule for shortened SEO friendly links: RewriteRule ^blog/([^/]*)\.html$ /blog/blog.php?pid=$1 [R=301,L] For Google SEO reasons, will the shortened rewritten link created from above be the permanent link, from the R=301? Even though the longer link is still functional? Or, do I need to create a rewritematch 301 rule to push the long url to the shortened url permanently? Thanks for the help! Much appreciated. JK
Ok..I just realized the rewriterule doesn't work with the [R=301,L] tag. Any idea how to make this 301 to the shortened link. Original long link sample: http://www.example.com/blog/blog.php?pid=great-article
I tried using this, but then the short url just redirects to the long one: RedirectMatch 301 /blog/blog.php?pid=(.*)$ http://www.example.com/blog/$1.html
Try this (I'm at work, so I haven't tested it): RewriteRule ^blog/([^/]*)\.html$ /blog/blog.php?pid=$1 [L] Code (markup):
Thanks Ryan. I figured it out this morning. This is what I did if anyone else has the same issue: RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /blog/blog\.php\?pid=([a-z0-9]+)\ HTTP/ [NC] RewriteRule ^blog/blog\.php$ http://www.example.com/blog/%1? [R=301,L] RewriteRule ^blog/([-a-z0-9]+)$ /blog/blog.php?pid=$1 [NC,L] Code (markup):