change ~username from url

Apache allow Per-user web directories. To change the url http://localhost/~username/sitename to http://localhost/sitename, disable the apache userdir module.

To remove ~username from url and access your site in web root as //http://localhost/sitename execute the following line in Terminal
sudo a2dismod userdir

Restart apache server to activate new configuration.

sudo /etc/init.d/apache2 restart

Conform is web root directory configured correctly.
"a2dismod" disable apache module. If you want to enable apache module use "a2enmod".

Install PHP Apache Mysql in Linux Ubuntu

Apache is the most commonly used web server. It is an open source and free web server. PHP is an open source server scripting language. It has a lot of advantages. MySQL is also an open source database used for small and medium data storage. It can also used for large data storage also.