I am new to .htaccess, i want to know how to use .htacces to prevent direct access via url of my folder e.g. localhost/mycart/images/ OR localhost/mycart/css should
You can simply add the following to your .htaccess
# Don't listing directory
Options -Indexes
ErrorDocument 403 http://www.your-website-home-page.com/
# Follow symbolic links
Options +FollowSymLinks
# Default handler
DirectoryIndex index.php
This will load only the index.php file while file browsing. If no index.php file is found 403 error happens (Access restricted) and it will send the user to home page