I want to hide files from sub directory
From this
mydomain.com/file/file.php
To this
mydomain.com/file/
Do you guys know how to do that?
Advertisement
Answer
In your home directory/.htaccess, add this line:
RewriteEngine On RewriteRule ^([^/]+)/$ $1/$1.php [L]
This will do this work:
mydomain.com/file/ => mydomain.com/file/file.php
mydomain.com/foo/ => mydomain.com/foo/foo.php
mydomain.com/bar/ => mydomain.com/bar/bar.php
The idea is to repeat the directory name as filename + .php extension in your real file system.