While the trusty Apache RewriteRule seems to be a "buzz-phrase" in the SEO world these days, there's a catchy acronym that's losing some ground. That acronym being KISS (Keep it Simple Stupid).
In the case of the question above, Rewrite Rules, while they provide an means to easily correct broken links that are widespread within a given website, they are contrary to the KISS rule. Rewrite Rules:
- Add another aspect of the website that you need to manage
- Create additional processing required by the web server
- Can make it difficult to debug problems with your site
Am I saying that Rewrite Rules are the root of all evil – absolutely not! They are extremely handy when the situation is beyond our control (outside sites linking to pages which don't exist), or when we simply want to create an "alias" for a page.
But, in the case of correcting internal URLs, they are a sub-optimal solution for all 3 reasons stated above.
Many webmasters turn to Rewrite Rules when the amount of broken links is just too overwhelming to even think about. But, if you are handy with a code editor, you might be able to employ a few techniques to automate the correction of these broken links.
Considering that website pages in general fall into two categories:
- Those served from a relational database
- Those served from a file system
The process to automate the correction of these links can be fairly simple. In the case of a file system based website, you can write a script which recursively navigates through your site folders, using basic Find/Replace or more advanced RegEx rules to correct the broken links. This would involve using only your scripting languages file operation and string manipulation commands.
In the case of database-driven website content, such as a WordPress site, the process is simpler. You can make use of your database's update statement and string manipulation functions, such as MySQL's replace to update the broken links within your page content.
Granted, not all websites fall under these two categories, such as Zope's object database. But, most application servers offer some method to programmatically change content. In the case of Zope/Plone, simply using a portal_catalog search combined with a fields mutator method (i.e. mypage.setText()) can make the process quick for you.