Well, the best place to start is reading Apache's mod_rewrite documentation page. Mind you, it's definitely NOT an easy read. It will take a lot of experimentation and fussing around to get results. Google is your friend; whatever you are thinking of doing, somebody else may have already solved.
Regarding security, the error_log shouldn't be web accessible anyway. The robots.txt must be web accessible, so you get to leave it as is. From that point, anythign you might need to add in your .htaccess file in the domain's web root (public_html), usually falls in the "utility" classification. For example:
- redirecting non-www to www, e.g. example.com redirected to www.example.com
- redirecting old domain names to the new one, e.g. www.example.org to www.example.com
- enabling a particular version of PHP to be used by default (according to your host's instructions)
The first two are widely available solutions if you search for them on Google. The latter one is host-specific.
One thing you should understand about .htaccess files is that they cascade, i.e. the Joomla! site will read both the root (public_html) and the site's (public_html/joomla) .htaccess files. The settings in the latter will override the settings in the former. The combined settings are what will be effective. This is why you can set the default PHP version in the main .htaccess file and be sure that all .php files accessed anywhere on the site will respect that setting.
.htaccess files are incredibly powerful. Remember that with great power comes great responsibility. Always keep copies of your working, tested .htaccess files before making any change. Trust me on that. You'll find out why when the time comes :)
Nicholas K. Dionysopoulos
Lead Developer and Director
🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!