Nov
17
2017

Only allow access to specific wordpress upload types if logged in

I had an interesting problem earlier today where I’d created a custom WordPress plugin which was to be logged-in-user only, and happened to include some uploaded content. So in proper developer format, I made sure to leverage WordPress’ great media uploading capabilities as opposed to arbitrarily creating something to store files within the plugin directory, but soon discovered a problem! Though you could only browse the actual list of files if you were logged in, […]

Jun
21
2013

Force www. prefix in URIs

For SEO, it’s best if you force WITH or WITHOUT the www. prefix for your site URL. And it’s as easy as adding a couple lines of code to your .htaccess file: <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine on #Enable these lines on prod server to require www. prefix RewriteCond %{HTTP_HOST} ^yoururl.com RewriteRule (.*) http://www.yoururl.com/$1 [R=301,L] </IfModule>

Jun
19
2013

Codeigniter Access to JS and CSS Files

This is a ‘fun’ .htaccess file addition that is (for reasons beyond me) necessary for codeigniter to allow you to use your CSS and JS files. Add this to your .htaccess and get on with your day! <IfModule mod_rewrite.c> RewriteEngine On #Checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn’t true it sends the #request to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond […]