
{"id":310,"date":"2009-10-18T18:28:27","date_gmt":"2009-10-18T22:28:27","guid":{"rendered":"http:\/\/www.ikriv.com\/blog\/?p=310"},"modified":"2009-10-18T18:28:27","modified_gmt":"2009-10-18T22:28:27","slug":"should-urls-depend-on-underlying-server-technology","status":"publish","type":"post","link":"https:\/\/ikriv.com\/blog\/?p=310","title":{"rendered":"Should URLs depend on underlying server technology?"},"content":{"rendered":"<p>I ran into an interesting problem when I was brushing up my web site lately. Let&#8217;s say I had a static HTML page named http:\/\/www.ikriv.com\/page.html.<\/p>\n<p>Now, I decided to use some kind of cool technology (PHP, ASP, JSP, CGI, SSI, FBI, CIA, USA, well, you get the picture). This would work only if I rename <b>page.html<\/b> to <b>page.php<\/b> (.asp, .jsp, .fbi, &#8230;). This is how the web server knows what technology to apply when rendering the page. This, however, has at least two downsides:<\/p>\n<ul>\n<li>The URL will change and external links will break. Not all external links are under my control.<\/li>\n<li>People, including Evil Hacker People, will now know what technology I use to generate the page.<\/li>\n<\/ul>\n<p>In the end I decided to use Apache URL rewrite feature to keep old URLs intact. It is quite easy to define in an <code>.htaccess<\/code> file in each web directory, but if you do something wrong, the rewriter quirks could be really annoying.<\/p>\n<p>Here&#8217;s a couple of examples:<\/p>\n<p><code><\/p>\n<pre>RewriteEngine on\nRewriteRule ^foo\\.html$ foo.php\n<\/code><\/pre>\n<hr \/>\n<p><code><\/p>\n<pre>RewriteEngine on\nRewriteRule ^(.*)\\.html$ $1.shtml\n<\/code><\/pre>\n<p>The people outside your server keep going to the old .html URL and the server does all the mapping seamlessly. A lot of rewrite rules will, of course, slow down a heavy loaded server, but a couple of rules here and there don't seem to hurt that much.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I ran into an interesting problem when I was brushing up my web site lately. Let&#8217;s say I had a static HTML page named http:\/\/www.ikriv.com\/page.html. Now, I decided to use <a href=\"https:\/\/ikriv.com\/blog\/?p=310\" class=\"more-link\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"Layout":"","footnotes":""},"categories":[17,4,5],"tags":[],"class_list":["entry","author-ikriv","post-310","post","type-post","status-publish","format-standard","category-apache","category-hack","category-dev"],"_links":{"self":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/310","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=310"}],"version-history":[{"count":0,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/310\/revisions"}],"wp:attachment":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=310"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}