Cannot display upload media after adding .htaccess
-
Hi,
I have encountered a problem about restricting the uploaded media. I have activated AAM in a new wordpress without other plugins, in a testing environment. Then I follow the instruction to create .htaccess at wp-content/uploads folder and enabled “Media Files Access Control” option on the Utilities tab.
After that, I try to upload a jpeg on the backend media Library using admin role, the file can be uploaded successfully but the image cannot be displayed. Then I try to access the jpeg using the URL directly but I got a blank page as well. I didn’t make any change on AAM setting at this moment so suppose the admin role should be able to access the jpeg by default.
Later on, I try to remove the .htaccess which located at wp-content/uploads folder and the image can show finally, however, it means that the physical file cannot be protected via AAM control manager.
Since the testing environment is sharing with other website, i have made some changes in the .htaccess as below:
# BEGIN AAM Media Access Control
RewriteEngine On
RewriteBase /XXX/XXX/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_URI} !(\.css|\.php|\.js)$
RewriteRule . index.php?aam-media=1 [L] <- Remove the starting ‘/’
# END AAM Media Access ControlSee if you can give some advises in this case.
Thanks.
The topic ‘Cannot display upload media after adding .htaccess’ is closed to new replies.