You could be able to give a priority to file when it request comes without / with same name with directory as well as removing both php & html and determine which one to check first like this :
DirectorySlash Off RewriteEngine on RewriteCond %{THE_REQUEST} \s/+(.*?/)?(?:index)?(.*?)\.(php|html)[\s?/] [NC] RewriteRule ^ /%1%2 [R=302,L,NE] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*) /$1.php [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.*) /$1.html [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !\/$ RewriteRule ^(.*) %{REQUEST_URI}/ [L,R=302]
So , by the code above , extensions will be removed then will check first if there is php file match this , then html and finally if there is a directory .
So , the request for /home only will check first a php that named home if it is exist ok , then directory home but the request /home/about will go directly to about inside home directory.
Clear browser cache then test it , if it is Ok , change 302 to 301 to get permanent redirection
yourdomain.com/homewhat is supposed to be requested -home.phpscript orhomedirectory? What exactly you want to achieve? What if you havehome.phpas directory name orhomeas script name with no extension? You must think off all scenarios.domain.com/homeshould displayhome.php. Then I want to have a folder calledhomewith other php files in it, e.g.about.php, such that I can callabout.phpviadomain.com/home/about. Can I achieve this using the.htaccessfile?!-drule.home.phpintohome/index.php, and be done with it.