{"id":80,"date":"2011-02-21T20:19:46","date_gmt":"2011-02-21T20:19:46","guid":{"rendered":"http:\/\/www.sitekickr.com\/blog\/?p=80"},"modified":"2011-02-21T20:19:46","modified_gmt":"2011-02-21T20:19:46","slug":"using-redirects-to-avoid-duplicate-pages","status":"publish","type":"post","link":"https:\/\/www.sitekickr.com\/blog\/using-redirects-to-avoid-duplicate-pages\/","title":{"rendered":"Using redirects to avoid duplicate pages"},"content":{"rendered":"<p>The issue here is that search engines consider the following two locations as distinct pages:<\/p>\n<p><em>http:\/\/www.mysite.com\/products<br \/>\n\t<\/em><\/p>\n<p><em>http:\/\/www.mysite.com\/products\/<br \/>\n\t<\/em><\/p>\n<p>In the case above, the solution is simple and many posts offer such a solution to add a slash to the end of the url. But, what happens when you have the following?<\/p>\n<p><em>http:\/\/www.mysite.com\/page-without-extension<br \/>\n\t<\/em><\/p>\n<p>This is an actual page (not a folder or directory) which simply doesn&#39;t have an extension (common in many Content Management Systems). Your global redirect commands will force a redirect to the following, which would return a 404.<\/p>\n<p><em>http:\/\/www.mysite.com\/page-without-extension\/<\/em><\/p>\n<p>In this case, we&#39;ll want to specify manually which locations should be given &quot;the slash treatment&quot;. Note, directives below are for the Apache web server (you can place these in a virtual host stanza, or in your .htaccess file)<\/p>\n<p><code>RewriteEngine on<br \/>\n\tRewriteCond %{REQUEST_FILENAME} !-f<br \/>\n\tRewriteCond %{REQUEST_URI} !\\..+$<br \/>\n\tRewriteCond %{REQUEST_URI} !\/$<br \/>\n\tRewriteCond %{REQUEST_URI} ^\/(products|services|about|contact)<br \/>\n\tRewriteRule (.*) http:\/\/www.mysite.com$1\/ [R=301,L]<\/p>\n<p>\t<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The issue here is that search engines consider the following two locations as distinct pages: http:\/\/www.mysite.com\/products http:\/\/www.mysite.com\/products\/ In the case above, the solution is simple&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":[19],"tags":[33,32,31],"_links":{"self":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/80"}],"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=80"}],"version-history":[{"count":1,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/80\/revisions"}],"predecessor-version":[{"id":81,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/80\/revisions\/81"}],"wp:attachment":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/media?parent=80"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/categories?post=80"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/tags?post=80"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}