I dont have cpanel access for my static website and there are two versions showing for website. I want to redirect that non www on www What to do? How can to do this with without .htaccess file ?
You can redirect all of the requests for yourdomain.com domain to www.yourdomain.com by modifying your website's .htaccess file. Do google and find code as per your need, You can edit the .htaccess file using the File Manager in cPanel or upload .htaccess file in root folder via FTP.
Below code for without www to www RewriteEngine On RewriteCond %{HTTP_HOST} ^websitedotcom$ RewriteRule ^(.*)$ httpcolondoublebackslashwwwdowebsitedotcom/$1 [R=301,L] Below code to redirect index.html on domain RewriteRule ^index\.html$ / [R=301,L] RewriteRule ^(.*)/index\.html$ /$1/ [R=301,L]
Due to no access for .htaccess file i did following changes - I used canonical tag in index.html page Ex - 2 pages xyz.com and xyz.com/index.html i used <link rel="canonical" href="httpcolondotdubblebackslashwwwdotwebsitedotcom"> And assign with www domain as preffered domain in google webmaster tool to solve www and without www url problem. Is this ok?