Comments on: Redirect non-www to www & HTTP to HTTPS using .htaccess file https://www.codexworld.com/redirect-non-www-to-www-http-to-https-using-htaccess-file/ Web & Mobile App Development Company Tue, 14 Mar 2023 14:13:39 +0000 hourly 1 By: Peter https://www.codexworld.com/redirect-non-www-to-www-http-to-https-using-htaccess-file/comment-page-1/#comment-224385 Tue, 20 Dec 2022 11:15:10 +0000 https://www.codexworld.com/?p=941#comment-224385 You can do it with one redirect..

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com$ [NC,OR]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.example.com/$1 [NC,L,R=301]

Just replace with Your domain.

]]>
By: Muhammad Arslan https://www.codexworld.com/redirect-non-www-to-www-http-to-https-using-htaccess-file/comment-page-1/#comment-193973 Tue, 26 Jul 2022 11:41:44 +0000 https://www.codexworld.com/?p=941#comment-193973 I have applied it. work well. but just for the home page. Thanks
What about other pages??

]]>
By: Bryson Frantz https://www.codexworld.com/redirect-non-www-to-www-http-to-https-using-htaccess-file/comment-page-1/#comment-133808 Tue, 02 Feb 2021 15:47:15 +0000 https://www.codexworld.com/?p=941#comment-133808 Perfect! Old article but still works great 5 years later!

]]>
By: Amit Kumar https://www.codexworld.com/redirect-non-www-to-www-http-to-https-using-htaccess-file/comment-page-1/#comment-43311 Thu, 16 Mar 2017 12:18:28 +0000 https://www.codexworld.com/?p=941#comment-43311 Hi, This is working fine but my other addons domains are affected they are also forwarding with my primary domain even i have not installed the SSL certificate for others…. waiting for positive response

]]>
By: Rali Dimitrov https://www.codexworld.com/redirect-non-www-to-www-http-to-https-using-htaccess-file/comment-page-1/#comment-41066 Wed, 15 Feb 2017 07:02:26 +0000 https://www.codexworld.com/?p=941#comment-41066 Tanks it works great! But after i use it, i can’t remove index.php . I’m using RewriteRule ^(.*)$ index.php/$1 [L]. Can you help me. Tank you, all the best !

]]>
By: Uresh https://www.codexworld.com/redirect-non-www-to-www-http-to-https-using-htaccess-file/comment-page-1/#comment-35390 Thu, 24 Nov 2016 14:41:39 +0000 https://www.codexworld.com/?p=941#comment-35390 Great Help

]]>
By: Wiki https://www.codexworld.com/redirect-non-www-to-www-http-to-https-using-htaccess-file/comment-page-1/#comment-33261 Wed, 26 Oct 2016 12:15:28 +0000 https://www.codexworld.com/?p=941#comment-33261 I m using codeigniter. It works for me. I was used at my site wiki-mobiles. Thanks

]]>
By: Tery https://www.codexworld.com/redirect-non-www-to-www-http-to-https-using-htaccess-file/comment-page-1/#comment-32561 Fri, 14 Oct 2016 12:18:19 +0000 https://www.codexworld.com/?p=941#comment-32561 Thanks it works for me.

]]>
By: pooja khokhani https://www.codexworld.com/redirect-non-www-to-www-http-to-https-using-htaccess-file/comment-page-1/#comment-32059 Tue, 04 Oct 2016 12:44:26 +0000 https://www.codexworld.com/?p=941#comment-32059 Thanks. its working

]]>
By: Ravi Kumar Sharma https://www.codexworld.com/redirect-non-www-to-www-http-to-https-using-htaccess-file/comment-page-1/#comment-30234 Fri, 26 Aug 2016 07:25:04 +0000 https://www.codexworld.com/?p=941#comment-30234 Your article is very nice to new PHP developers, i am also new in PHP development field and your post very helpful for me to understand about .htaccess. You have written very simple English language so thanks for sharing.

]]>