First you need to know about your site have which types of server. Mostly these types of server use a htaccess file: 1- Linux , 2- Apache if your hosting account use one of these type of server then you can coply below code at your htaccess file. Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^ example.com [NC] RewriteRule ^(.*)$ http://www.example .com/$1 [L,R=301] RewriteCond %{REQUEST_URI} ^(.*)//(.*)$ RewriteRule . http://www.example.com%1/%2 [R=301,L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(([^/]+/)*)index\.html\ HTTP/ RewriteRule index\.html$ http://www.example.com/%1 [R=301,L]\ Note: In red highlights, you need to replace example.com with your domain name and in green highlights, you need to replace with your .html or .php index page. Keep in mind do not write just index, write extension too. After copy this code with your htaccess old code, Save it and upload at your root folder where your site have index page. Hope it will solved.
I totally agree with everything thta nosheen hayat said. And would like to add that these are the most common hosting servers and are also the easiest to implement a permanent 301 redirect.