Fixes #5043 Photo uploading from ckeditor

This is a rebase of #5653, using the new .htaccess rules in master.