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:

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!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close