Edge_jr Posted August 16, 2022 Share Posted August 16, 2022 How to redirect website from non-www to www URL using .htaccess I mean https://example.com to https://www.example.com when visitors visit the website in the browser. Link to comment Share on other sites More sharing options...
Zohaib-fk Posted August 16, 2022 Share Posted August 16, 2022 HI, You can add the below code in your htaccess RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] Link to comment Share on other sites More sharing options...
Edge_jr Posted August 16, 2022 Author Share Posted August 16, 2022 35 minutes ago, Zohaib-fk said: HI, You can add the below code in your htaccess RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] Thanks. It works fine. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now