{"id":916,"date":"2021-01-15T17:30:32","date_gmt":"2021-01-15T11:30:32","guid":{"rendered":"https:\/\/hasibul.info\/blog\/?p=916"},"modified":"2021-01-15T17:30:32","modified_gmt":"2021-01-15T11:30:32","slug":"how-to-redirect-www-to-non-www-url-using-htaccess","status":"publish","type":"post","link":"https:\/\/hasibul.info\/blog\/2021\/01\/15\/how-to-redirect-www-to-non-www-url-using-htaccess\/","title":{"rendered":"How to redirect www to non-www URL using htaccess"},"content":{"rendered":"<p>To redirect all www traffic to non-www URL &#8211; you need to add the following lines in .htaccess file:<\/p>\n<blockquote><p><span class=\"hljs-attribute\"><span class=\"hljs-nomarkup\">RewriteEngine<\/span><\/span> <span class=\"hljs-literal\">On<\/span><\/p>\n<p><span class=\"hljs-attribute\"><span class=\"hljs-nomarkup\">RewriteCond<\/span><\/span> <span class=\"hljs-variable\">%{HTTP_HOST}<\/span> ^www.example.com<span class=\"hljs-meta\"> [NC]<\/span><\/p>\n<p><span class=\"hljs-attribute\"><span class=\"hljs-nomarkup\">RewriteRule<\/span><\/span> ^(.*)$ http:\/\/example.com\/<span class=\"hljs-number\">$1<\/span><span class=\"hljs-meta\"> [L,R=301]<\/span><\/p><\/blockquote>\n<p>Replace example.com with your own domain name.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To redirect all www traffic to non-www URL - you need to add the following lines in .htaccess file: RewriteEngine On RewriteCond %{HTTP_HOST} ^www.example.com [NC] RewriteRule ^(.*)$ http:\/\/example.com\/$1 [L,R=301] Replace example.com with your own domain name.<\/p>","protected":false},"author":1,"featured_media":917,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13,18,17,6,12,203],"tags":[522,521,95,523,524,304],"how-to":[],"_links":{"self":[{"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/posts\/916"}],"collection":[{"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/comments?post=916"}],"version-history":[{"count":0,"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/posts\/916\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/media\/917"}],"wp:attachment":[{"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/media?parent=916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/categories?post=916"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/tags?post=916"},{"taxonomy":"how-to","embeddable":true,"href":"https:\/\/hasibul.info\/blog\/wp-json\/wp\/v2\/how-to?post=916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}