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!
Related Posts
- ASP .NET & System.Threading.ThreadAbortException Error While doing some work today I started to run into a ThreadAbortException error. While debugging it spit back this error: Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack. I was really confused because everything seemed to be working...
- OS X and Tabs – Skipping Drop Down Controls Comcast is supposed to come tomorrow to hook up my house, but until then I've been mooching of relatives' WI-FI on my Mac Book Pro. ... Of course the OS X elite call this change simple and easy, but I'd think it'd be easy to just have it work in...