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 “files” directory:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/files/(.*)$ RewriteRule ^.*$ - [L] </IfModule>
The final file content looks like this:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/files/(.*)$ RewriteRule ^.*$ - [L] </IfModule> # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
Now, you can link this files in your posts with www.yourdomain.com/files/myfile.txt
hi,
thanksfor your sharing this wonderful coding it help me alot.
http://www.mpcalling.com
thanks