How to perfectly redirect non-www URLs to www
Pretty posts
Non-www and www version there are two url format for your site. You need to fix it to prevent from duplicate content.To redirect all of your
yourdomain.com or yourdomain.com/sub-folder visitors to www.yourdomain.com or www.yourdomain.com/sub-folder, you should need to add following code at the beginning of your .htacess file in your public_html folderFor yourdomain.com to www.yourdomain.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]
Change yourdomain.com with your website name. After add it, when someone accesses to http://yourdomain.com he/she will be redirected to http://www.yourdomain.comFor yourdomain.com/sub-folder to www.yourdomain.com/subfolder
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{REQUEST_URI} ^/sub-folder/
RewriteRule ^(.*)$ http://www.yourdomain.com/sub-folder/$1 [R=301,L]
Change yourdomain.com with your website name and also sub-folder text with your existing sub-folder name. After add it, when someone accesses to http://yourdomain.com/sub-folder he/she will be redirected to http://www.yourdomain.com/sub-folderThat's it and it's safe method.
Advanced Tips: You can use it for your WordPress or any kind of site.




Sir Please Update Step by step for wordpress website
ReplyDeleteIt's easy bro. Just add code in your .htaccess file. You will find it in your WordPress root folder.
Deletewhere to put this code head section aur last
ReplyDeleteIt's for own hosting site like for WordPress and you need to paste this in your .htaccess file. For blogger see below comment.
DeleteWhat about blogger templates? Is there a way to use this?
ReplyDeleteFor example, if I type timesaver.pt I get an error
You can do it from blogger dashboard. Go to Blogger>Settings>Basic and click on edit from Blog Address then tick on "Redirect timesaver.pt to www.timesaver.pt"
Deletesir website ki loading speed kaise badye
ReplyDelete