I have a website, example.com
I also have sub-directories as under:
example.com/dir1/
example.com/dir2/
example.com/dir3/
Now, I am looking to redirect the visitor to 404 if they they try to access:
example.com/dir1/
But not in case, when they try to access :
example.com/dir1/example.php
Below is my .htaccess :
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php
RewriteRule ^index\.php$ / [L,R=301]
Options -Indexes
with above htaccess i get a default error when i try to access any subdirectory as under:
Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
Apache/2.4.16 (Win32) OpenSSL/1.0.1p PHP/5.6.12