php - how to protect uploads folder with .htaccess to only allow images in wordpress site -


i have question need protect site uploading and/or executing scripts or files other images in wordpress site.

but have tried few variations .htaccess file , no success.

the wordpress have wp-content/uploads folder uploads stored. , inside it's sorted based on year / month combination in folders. used example wordpress site somehow locks entire folder , can't see images.

<files ^(*.jpeg|*.jpg|*.png|*.gif)>    order deny,allow    deny </files> 

so there working way on making available upload , sort images inside wp-content/upload folders , later on access them. think problem there subfolders sinside uploads or wrong ?

so htaccess solution won't affect can upload recursively effect access subdirectories.

rewriteengine on #if file not have 1 of theses extensions rewritecond %{request_uri} !\.(png|jpg|jpeg|gif)$ #then should marked forbidden. rewriterule .*$ - [f] 

that should it.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -