RewriteEngine On

# Rewrite e. g. /real-media-library/php/ to /real-media-library/php/index.html
# or /real-media-library/php to /real-media-library/php/index.html
# See also #5yg1cf
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/index\.html$ [NC]
RewriteRule ^(?:(.+))?\/$ /$1/index.html [L,NC,R=301]