htaccess: Add install step for a proper .htaccess

Install a new writeHtaccess() function in the install process that takes
/htaccess-dist and replaces {BASE_URL} for the appropiate value used by
RewriteBase to find Chamilo files.

This solves the problem of Chamilo installations that are not hosted on
a web server root. Namely, all the http://domain/chamilo-lms installs.

The method follows similar practice by WordPress where the .htaccess
file is generated by WordPress on demand when the user activates pretty
permalinks.

A follow–up commit enhances the safety of this process by making sure
the site URL is clean enough for RewriteBase.
install: Clean trailing slashes in site URL

This ensures that accidental trailing slashes does not break the site
after installation.

This is important for the automatic generation of the .htaccess file,
since RewriteBase depends on a valid, clean, URL path to work.

When RewriteBase is wrong, many different and obscure errors can pop in
the site, so it's better to be very sure.

Arguably, this might not be the best place for input filtering during
the installation.
Merge pull request #249 from diegoe/master_install-htaccess

Generate .htaccess with correct RewriteBase during installation