301 Redirection is very important for our website for redirecting website on one direction because search engine may be index three copies of the same webpage. So, there is a chance of duplicate content and May your rank from search engine may be drop from searches.
301 Redirection is also good for better SEO of a website. You can point your website to only www or without www or to index. We will use .htaccess for redirection of your website just follow our below method and add 301 Redirection on your website.
First of all you need to create .htaccess file on your server and add below codes.
Redirecting non-www to www (root)
Redirecting index.html to www (root)
Redirecting index.php to www (root)
Redirecting index.html and non-www to www (root)
Use the above code to redirect your website for the better SEO of your website. As you know that better SEO help to rank better in search engine.