10
Well, my doubt is simple:
How can I block direct access to files and directories on my website? For example, prevent the user from accessing the link: www.meusite.com/img
and get the list of images, or /js
and get the JS files, and so on.
Today I own a file index
blank in each folder, which "blocks" the access, or rather, the view.
I tried to use the htaccess
to create this lock, something like that:
<Directory ~ "\">
Order allow,deny
Deny from all
</Directory>
However I am getting total block, not even browsing the site is allowed. The only other configuration I have in my htaccess
is the rewrite
to improve the url
site. How I am working with the routes in AngularJs
, the code below serves to remove the /#/
that is added.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
How can I get the result? Because I have already visualized some websites that when accessing the folder, we get the result of "Forbiden access" which, I believe, is the most correct process to be done.
Or... What is the real purpose/logic I should have in this regard?
In
/caminho
what should I specify? My htaccess file is at the root of the server/public_html
and it needs to be there for the rewrite with Angularjs to work. I tried naming some folders but all return me with error 500 Internal Server Error– celsomtrindade
no. htaccess does not need path, it is only the
Options -Indexes
same, the only way is to use in apache config– Bacco
The yes, perfect one! The solutions I found were always very complex, with the name of the directories and files that we wanted to block or allow access and always returned some error or blocked full access. I didn’t think it would be so simple. Thank you!
– celsomtrindade