2

I found that the following code online could be used to spoof the WordPress uploads folder, rewriting URLs to a different folder on the server:

# BEGIN Spoof wp-content/uploads directory
RedirectMatch 301 ^/uploads/(.*)$ https?://yoursite.com/wp-content/uploads/$1
# END Spoof wp-content/uploads directory

It is my understanding that under Media settings page the 'Full Path to files' needs to point to desired spoof folder.

I have tried using the above code but WordPress throws a error 404. My uploads are set to be organized by year and month. The file was that uploaded and tested indeed exists on the server.

Here is an example of the structure setup:

Real folder path -> http://yoursite.com/wp-content/uploads/2011/09/icon.jpg Spoofed folder path -> http://yoursite.com/uploads/2011/09/icon.jpg

My question: Is there anything wrong with the rewrite code that could lead to the error 404 issue?

1 Answer 1

2

yes, this:

https?://yoursite.com

doesn't do anything you want, just make it http://yoursite.com. Next to that, make sure your server actually supports RedirectMatch.

1
  • Thanks, Joost! I am not even why I had that in there in the first place, but removing it was the solution. Oct 7, 2011 at 0:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.