{"id":2481,"date":"2016-05-20T08:38:29","date_gmt":"2016-05-20T15:38:29","guid":{"rendered":"http:\/\/www.wellgolly.com\/?p=2481"},"modified":"2018-01-12T10:07:57","modified_gmt":"2018-01-12T18:07:57","slug":"odd-thing-about-symlinks","status":"publish","type":"post","link":"https:\/\/www.wellgolly.com\/?p=2481","title":{"rendered":"Odd Thing About Symlinks"},"content":{"rendered":"<p>I refactored a site recently and rather than having a bunch of files with identical headers and footers, I created an index.php file with conditionals to create the meta data and then include the content. To preserve the existing file structure, I just created symlinks to the index.php file. So I did something like this:<br \/>\n<pre><code class=\"preserve-code-formatting\">\nln -s index.php oldname1.php\nln -s index.php oldname2.php<\/code><\/pre><\/p>\n<p>This works great and is pretty easy to implement. (Yes there are other ways to do it.) <\/p>\n<p>I ran into a problem when I tried to create symlinks in some subdirectories to prevent the \u201cYou don&#8217;t have permission to access \/include.php\/ on this server.\u201d error message. I turns out that you have to be in the subdirectory where you want the alias to reside. This works:<br \/>\n<pre><code class=\"preserve-code-formatting\">\ncd Guides\nln -s ..\/manuals\/index.php index.php<\/code><\/pre><br \/>\nThis does not:<br \/>\n<pre><code class=\"preserve-code-formatting\">\ncd manuals\nln -s index.php Guides\/index.php<\/code><\/pre><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I refactored a site recently and rather than having a bunch of files with identical headers and footers, I created an index.php file with conditionals to create the meta data and then include the content. To preserve the existing file structure, I just created symlinks to the index.php file. So I did something like this: &hellip; <a href=\"https:\/\/www.wellgolly.com\/?p=2481\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Odd Thing About Symlinks<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-2481","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/2481","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2481"}],"version-history":[{"count":0,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/2481\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}