{"id":408,"date":"2011-11-04T13:56:16","date_gmt":"2011-11-04T13:56:16","guid":{"rendered":"http:\/\/www.sitekickr.com\/blog\/?p=408"},"modified":"2012-10-20T20:15:07","modified_gmt":"2012-10-20T20:15:07","slug":"correct-vs-redirect","status":"publish","type":"post","link":"https:\/\/www.sitekickr.com\/blog\/correct-vs-redirect\/","title":{"rendered":"To Correct, or Redirect, That is the Question"},"content":{"rendered":"<p>While the trusty Apache RewriteRule seems to be a &quot;buzz-phrase&quot; in the SEO world these days, there&#39;s a catchy acronym that&#39;s losing some ground. That acronym being KISS (Keep it Simple Stupid).<\/p>\n<p>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:<\/p>\n<ul>\n<li>Add another aspect of the website that you need to manage<\/li>\n<li>Create additional processing required by the web server<\/li>\n<li>Can make it difficult to debug problems with your site<\/li>\n<\/ul>\n<p>Am I saying that Rewrite Rules are the root of all evil &#8211; absolutely not! They are extremely handy when the situation is beyond our control (outside sites linking to pages which don&#39;t exist), or when we simply want to create an &quot;alias&quot; for a page.<\/p>\n<p>But, in the case of correcting internal URLs, they are a sub-optimal solution for all 3 reasons stated above.<\/p>\n<p>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.<\/p>\n<p>Considering that website pages in general fall into two categories:<\/p>\n<ul>\n<li>Those served from a relational database<\/li>\n<li>Those served from a file system<\/li>\n<\/ul>\n<p>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.<\/p>\n<p>In the case of&nbsp; database-driven website content, such as a WordPress site, the process is simpler. You can make use of your database&#39;s update statement and string manipulation functions, such as MySQL&#39;s replace to update the broken links within your page content.<\/p>\n<p>Granted, not all websites fall under these two categories, such as Zope&#39;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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While the trusty Apache RewriteRule seems to be a &quot;buzz-phrase&quot; in the SEO world these days, there&#39;s a catchy acronym that&#39;s losing some ground. That&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"amp_status":""},"categories":[41,13,19,103],"tags":[137],"_links":{"self":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/408"}],"collection":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/comments?post=408"}],"version-history":[{"count":5,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/408\/revisions"}],"predecessor-version":[{"id":936,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/408\/revisions\/936"}],"wp:attachment":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/media?parent=408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/categories?post=408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/tags?post=408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}