Local LAMP Developement & User Content

I've come up with a simple solution for handling user uploaded content when trying to work in a local development environment. I've installed XAMPP on my windows machine and at the beginning of every week I take a database snapshot and update my local database. I had a pretty smooth system going with one problem: user uploaded content.

When working with social networking sites, many times they allow for users to upload their own videos, pictures, etc. My current project wasn't different, but I didn't want to download 80GB of user content every week to store on my PC. I wanted a way to point my browser to the live server to get recent images, etc.

My solution was simple: .htaccess file using a 301 redirect. I basically told my local apache server to return a HTTP status of 301 (Moved Permanently) and point the browser to the live content. I created a .htaccess file inside the "uploads" directory and added one line of code:

CODE:
  1. Redirect 301 /uploads http://www.example.com/uploads

I restarted apache and now when I work locally, I can still see all of the user's photos and uploaded content. Works like a champ!

Related Posts

  1. My PHP User Group Experience I've been meaning to blog about this for awhile now, but never got around to it. I woke up and couldn't sleep only 1 hour before heading out for some Black Friday madness. Might as well make some use of me being awake. I will have to say that belonging...
  2. “Nerfing” a PHP Object I was trying to think of something with PHP I could blog about that would be short and sweet. Then I thought of something that a good friend of my taught me: nerfing objects. The Problem Many times while working with PHP and bigger frameworks, you'll have classes that extend...
  3. VirtualBox Networking Setup Every time I go to set up VirtualBox and several VMs I always forget how I setup the networking for them. Once again, I went through the pain of trying to figure it all out, so I might as well document it for future use. The Problem When creating virtual...

Posted in Programming. Tagged with , , , , .

0 Responses

Comments RSS Feed.

Some HTML is OK

(required)

(required, but never shared)

or, reply to this post via trackback.

Powered by WP Hashcash