{"id":638,"date":"2013-02-01T10:45:45","date_gmt":"2013-02-01T09:45:45","guid":{"rendered":"http:\/\/elkano.org\/blog\/?p=638"},"modified":"2013-02-01T10:47:09","modified_gmt":"2013-02-01T09:47:09","slug":"accessing-local-directory-in-wordpress","status":"publish","type":"post","link":"https:\/\/elkano.org\/blog\/accessing-local-directory-in-wordpress\/","title":{"rendered":"Accessing local directory content from wordpress"},"content":{"rendered":"<p>Sometimes you want to upload some files into a local directory in your wordpress installation directory and link these files in your posts. To achieve this you have to modify your .htaccess file in your wordpress installation directory and put this directives before WordPress directives. Assuming you want to store some files in &#8220;files&#8221; directory:<\/p>\n<pre class=\"dontquote prettyprint xml-lang\">\r\n&lt;IfModule mod_rewrite.c&gt;\r\nRewriteEngine On\r\nRewriteBase \/\r\nRewriteCond %{REQUEST_URI} ^\/files\/(.*)$\r\nRewriteRule ^.*$ - [L]\r\n&lt;\/IfModule&gt;\r\n<\/pre>\n<p>The final file content looks like this:<\/p>\n<pre class=\"dontquote prettyprint xml-lang\">\r\n&lt;IfModule mod_rewrite.c&gt;\r\nRewriteEngine On\r\nRewriteBase \/\r\nRewriteCond %{REQUEST_URI} ^\/files\/(.*)$\r\nRewriteRule ^.*$ - [L]\r\n&lt;\/IfModule&gt;\r\n\r\n# BEGIN WordPress\r\n&lt;IfModule mod_rewrite.c&gt;\r\nRewriteEngine On\r\nRewriteBase \/\r\nRewriteRule ^index\\.php$ - [L]\r\nRewriteCond %{REQUEST_FILENAME} !-f \r\nRewriteCond %{REQUEST_FILENAME} !-d \r\nRewriteRule . \/index.php [L]\r\n&lt;\/IfModule&gt;\r\n\r\n# END WordPress\r\n<\/pre>\n<p>Now, you can link this files in your posts with www.yourdomain.com\/files\/myfile.txt<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes you want to upload some files into a local directory in your wordpress installation directory and link these files in your posts. To achieve this you have to modify your .htaccess file in your wordpress installation directory and put this directives before WordPress directives. Assuming you want to store some files in &#8220;files&#8221; directory: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[80,81,79],"_links":{"self":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts\/638"}],"collection":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/comments?post=638"}],"version-history":[{"count":8,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts\/638\/revisions"}],"predecessor-version":[{"id":646,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts\/638\/revisions\/646"}],"wp:attachment":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/media?parent=638"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/categories?post=638"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/tags?post=638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}