To L or not to L. I'm not sure which Google will like better [R=301] or [R=301,L] and recognize as a 301 in my example below. My understanding is the the L tells Apache to not process any more RewriteRules if this one was successful. The redirect does work whether I use the [L] or not. I need the last two lines to process but am not sure if [R=301,L] will stop Google before it gets to them. (I'm just so paranoid about messing up my 301's & losing PR.) RewriteEngine on RewriteBase / RewriteRule ^old1/?$ new1/ [R=301] RewriteRule ^old2/?$ new2/ [R=301] RewriteRule ^old3/?$ new3/ [R=301] RewriteRule ^([^/\.]+)/?$ index.php?id=$1 [L] RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?cat=$1&id=$2 [L]
Google doesn't care whether you use 'L' or not in your rewrite rule. They see nothing different. All they see is a 301 HTTP status code in the header along with a new location of where the page was moved. The 'L' is a Mod Rewrite specific flag. If you include the 'L' and the RewriteRule and associated RewriteConds all match then Mod Rewrite will bail and perform that particular 301 redirect. It won't process any more rules from the .htaccess files. If you omit the 'L' then Mod Rewrite will continue executing the subsequent RewriteRules in the file. Omitting the 'L' flag is a way to daisychain rules (if it matches rule/conds A then do rewrite A... then use the output of rewrite A to check if it matches rule/conds B. If so perform rewrite B ... etc... until it hits a rule that both matches and includes an 'L'). The 'L' simply says STOP PROCESSING RULES if this one matchs.
Absolutely... It gives the target URL of the 301 credit for all existing backlinks pointing to redirected URL. Because PR is based on a URL's backlinks and the target URL now gets credit for those links, they also get credit for the PR. The target URL also gets credit for all of the link text used to link to the redirected URL. 302 redirects, however, do NOT pass credit for inbound links and do NOT pass PR.