You need to setup it in your .htaccess file, it should looks like this one:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^yourdomain\.com$
RewriteRule (.*) http://www.yourdomain.com$1com/$1 [R=301[L,L]R=301]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>