Thanks for your answers, but I still have a couple of doubts. Let me recapitulate my situation:
During the last years I've been using this kind of permalink:
http://www.example.com/news/title-of-article/
Now, the new version of my CMS offers me the possibility to use this permalink:
http://www.example.com/title-of-article/
I think that the last URL is better than the previous one, but before applying these changes in my website I need to use 301 redirects to send Google and users from the old pages to the new ones. Although I'm trying to learn how mod_rewrite works reading a lot about the subject, my knowledge about this module is still very limited, so that's why I'm here asking to experts like you ;-)
The
URL Rewriting Guide [httpd.apache.org] published at the apache.org page explains that:
Content Handling
From Old to New (intern)
Description:
Assume we have recently renamed the page foo.html to bar.html and now want to provide the old URL for backward compatibility. Actually we want that users of the old URL even not recognize that the pages was renamed.
Solution:
We rewrite the old URL to the new one internally via the following rule:
RewriteEngine on
RewriteBase /~quux/
RewriteRule ^foo\.html$ bar.html
The old URL is on the left and the new one on the right. Then, why I can indistinctly use one of these two expressions and the system, when I write at the address bar a permalink like
example.com/news/title-of-article, shows me in both cases the contents of its "brother"
example.com/title-of-article without any error warning?
RewriteRule ^news/([a-z0-9]+)$ $1/ [R=301,L]
RewriteRule ^([a-z0-9]+)$ news/$1 [R=301,L]
Supossedly, only the first one is correct, isn't it?
My second doubt is related to Google. These rules (well, I suppose that only one of them), as I wrote them, properly notify the search engines about the changes and the link between the old and the new URLs? In other words: I won't be penalized by Google if I use the RewriteRule in this way?
Thank you.