Non WWW to WWW redirect using HTACCESS

This is my first post about htaccess.In this am going to explain how to redirect Non WWW website url to WWW website url using htaccess.


Htaccess Code

        RewriteEngine On //ON rewrite Engine
        RewriteCond %{HTTP_HOST} !^www\. //Write Condition for want you want to redirect
        RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] //Rule for redirect



[R=301] is a permanent redirect.
[L,R=301] [L] just means it's the last one, so it can stop looking for more rewrite rules if one matches that one. To display images using HTML use the following code.

 Note: .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.

Please share your comments and feedback.Thanks.Please subscribe my updates via email.

1 comment:

  1. Las Vegas' Wynn Casino - JTM Hub
    Casino. Wynn is a $4 billion resort https://febcasino.com/review/merit-casino/ with four hotel towers casinosites.one with 5,750 rooms and suites. Each of the hotel towers includes www.jtmhub.com a 20,000 square foot https://octcasino.com/ casino and a worrione

    ReplyDelete