Is there any way to protect/rewrite images under uploads/ folder

  • Author
  • #3090250


    We have a plugin which protects certain images and serves them to the user if they are logged in and have the right permissions.

    To do this, we have to rewrite all the images to wordpress so our code can check the user, and then serve the image if the user is valid.

    The htaccess rule we have works splendidly for singular WordPress installs on hosts that use Apache. But it doesnt work for multisite hosts or hosts that use nginx.

    So it doesnt work at

    There are other plugins which protect uploads/ folder or directories under it, like Easy Digital Downloads. EDD has below tutorial for nginx hosts, and some specific hosts like

    But these dont work at


    So the question is:

    Is there any way we can make a site at rewrite all the images to our plugin internally? This doesnt need to be through a htaccess rule addition, it can be through a wordpress internal rewrite rule as well.

    Thanks in advance.

    The blog I need help with is


    Hi unity100,

    I see you chatted with one of our Happiness Engineers about this and they provided the information you needed. You are welcome to start a new chat if there is anything else you would like to know:



    Yes we did talk. It seems there isnt any way to add custom rewrite rules to redirect images to WordPress.

    I opened this topic thinking that there may be developers who had the same issue and found a custom solution.

The topic ‘Is there any way to protect/rewrite images under uploads/ folder’ is closed to new replies.