htaccess Redirect Method non-www to www and HTTP to HTTPS
htaccess Redirect Method non-www to www and HTTP to HTTPS
HTACCESS REDIRECT METHOD NON-WWW TO WWW AND HTTP TO HTTPS

This is My Second Tutorial Related to htaccess in previous Tutorial we see about htaccess Method to Remove a .php and .html extensions.htaccess File are Very Important because it controls Our website Outside Mechanism Process like Page redirection, Directory redirection in previous tutorial I explain about the htaccess File Working.ok let’s come to our topic.
HTACCESS METHOD REDIRECT NON-WWW TO WWW
Google Recommends www URLs yes as per Search Engine NOn-www and www are Different.If we use Both non-www and www means search Engine treated as duplicate contents.you can use htaccess Method Redirect non-www to www.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mywebsite.com [NC]
RewriteRule ^(.*)$ http://www.mywebsite.com/$1 [L,R=301,NC]
HTACCESS DIRECTORY REDIRECTION
RewriteCond %{HTTP_HOST} ^mywebsite\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mywebsite\.com$
RewriteRule ^folder\/?$ "http\:\/\/www\.myebsite\.com\/" [R=301,L]
HTACCESS METHOD REDIRECT HTTP TO HTTPS
https Means Secure Hypertext Transfer Protocol.which was used to secure our user’s Information, Data’s and Payment Gateway’s.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.mysite.com/$1 [R,L]
FORCE HTTP TO HTTPS REDIRECTION
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} folder
RewriteRule ^(.*)$ https://www.mysite.com/folder/$1 [R,L]
FROM THE EDITOR’S DESK
Don’t forget to replace mysite.com with your website’s domain name.
If you Have Any Doubts Feel free to comment here i will help you.
Updated Post for HTTPS Version – Proper Method to redirect our visitors to HTTPS version via htaccess File
Also Read
Comments
Post a Comment