{"id":177,"date":"2011-08-23T06:35:35","date_gmt":"2011-08-22T18:35:35","guid":{"rendered":"http:\/\/tripalot.com\/travis\/blog\/?p=177"},"modified":"2011-08-25T10:45:11","modified_gmt":"2011-08-24T22:45:11","slug":"php-handler","status":"publish","type":"post","link":"https:\/\/tripalot.com\/travis\/blog\/php-handler\/","title":{"rendered":"PHP Handler"},"content":{"rendered":"<p>Over the past month or two, I have updated all of my sites&#039; URLs to no longer include the HTML filenames.\u00a0 So, instead of \/games\/catan.htm the URL is now \/games\/catan\/. The latter is (I think) more SEO friendly, and allows me to switch to make the page dynamic later without changing the URL again.<\/p>\n<p>I&#039;d already converted a few sites to the no-filename approach, which resulted in each HTML file being called index.html.\u00a0 This worked, but when I opened a bunch of pages in a text editor, each tab said &#034;index.html&#034; which made it hard to tell them apart.<\/p>\n<p>So this time I decided to keep the HTML files named uniquely (e.g., catan.htm).\u00a0 In order to get the sites to work, I wrote a PHP handler to parse the URL and read in the correct file.\u00a0 This also lets me add global features, like a favicon, google analytics, and a google plus one button to each page.<\/p>\n<p>To be able to view my sites locally before uploading, I setup a local web server, and, for times when I want to view the file without a server, I wrote a JavaScript handler to rewrite all the links in the page to point to the correct local pages.<\/p>\n<p>So the end result is that I was able to keep the HTML files relatively intact (with only link urls changing), named distinctly (not all &#034;index.html&#034;), viewable locally and online, and now with google analytics and favicons automatically added.<\/p>\n<p>All this programming was a lot of work, but it&#039;s a one-time effort, and lets me start using Web 2.0 features in my sites, something I wasn&#039;t able to do before.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Over the past month or two, I have updated all of my sites&#039; URLs to no longer include the HTML filenames.\u00a0 So, instead of \/games\/catan.htm the URL is now \/games\/catan\/. The latter is (I think) more SEO friendly, and allows me to switch to make the page dynamic later without changing the URL again. I&#039;d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[29,27,28],"_links":{"self":[{"href":"https:\/\/tripalot.com\/travis\/blog\/wp-json\/wp\/v2\/posts\/177"}],"collection":[{"href":"https:\/\/tripalot.com\/travis\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tripalot.com\/travis\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tripalot.com\/travis\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tripalot.com\/travis\/blog\/wp-json\/wp\/v2\/comments?post=177"}],"version-history":[{"count":7,"href":"https:\/\/tripalot.com\/travis\/blog\/wp-json\/wp\/v2\/posts\/177\/revisions"}],"predecessor-version":[{"id":269,"href":"https:\/\/tripalot.com\/travis\/blog\/wp-json\/wp\/v2\/posts\/177\/revisions\/269"}],"wp:attachment":[{"href":"https:\/\/tripalot.com\/travis\/blog\/wp-json\/wp\/v2\/media?parent=177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tripalot.com\/travis\/blog\/wp-json\/wp\/v2\/categories?post=177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tripalot.com\/travis\/blog\/wp-json\/wp\/v2\/tags?post=177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}