{"id":11374,"date":"2025-06-19T12:15:01","date_gmt":"2025-06-19T06:45:01","guid":{"rendered":"https:\/\/veewom.com\/articles\/?p=11374"},"modified":"2025-06-19T12:16:15","modified_gmt":"2025-06-19T06:46:15","slug":"how-to-make-country-wise-website-on-same-domain","status":"publish","type":"post","link":"https:\/\/veewom.com\/articles\/how-to-make-country-wise-website-on-same-domain.htm","title":{"rendered":"How To Make Country Wise Website on Same Domain"},"content":{"rendered":"<p><strong>Country Wise Website Using PHP<\/strong> | Hello everyone ,welcome to another fresh article ,in this article I will teach you how to make a simple country wise website on php, for example, visitor visit your website in India, so it&#8217;s automatic redirect to India version like domian.com\/hi and if visitor visit your website outside of India like in us and another country so it automatically redirects to root domain or domian.com\/en.<\/p>\n<p>it&#8217;s a very simple process, here is simple code, you can use in your index file, just copy and paste below code in your website index file it&#8217;s automatic worked, on India and us ,also you can modify this code as per your choice ,mean&#8217;s you can add more country on switch case.<\/p>\n<blockquote><p><strong>Note: <\/strong>Learn in details about making this type website, so you need to watch below video, so please watch below video, video language is hindi, I will try to add subtitles soon.<\/p><\/blockquote>\n<pre><code class=\"php\">\r\n&lt;?php\r\n\r\n  $user_ip = getenv('REMOTE_ADDR');\r\n  $geo = unserialize(file_get_contents(\"http:\/\/www.geoplugin.net\/php.gp?ip=$user_ip\"));\r\n  $country = $geo[\"geoplugin_countryName\"];\r\n\r\n  switch ($country) {\r\n    case \"India\":\r\n        header('Location:http:\/\/domain.com\/hi');\r\n        break;\r\n    case \"United States\":\r\n        header('Location:http:\/\/domain.com\/en');\r\n        break;\r\n    default:   \r\n        header('Location:http:\/\/domain.com');  \r\n  }\r\n\r\n?&gt;\r\n\r\n<\/code><\/pre>\n<h2>Watch a Video<\/h2>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/qn1jVQ27EIg\" width=\"100%\" height=\"350px\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Country Wise Website Using PHP | Hello everyone ,welcome to another fresh article ,in this article I will teach you how to make a simple country wise website on php, for example, visitor visit your website in India, so it&#8217;s automatic redirect to India version like domian.com\/hi and if visitor visit your website outside of &hellip; <a href=\"https:\/\/veewom.com\/articles\/how-to-make-country-wise-website-on-same-domain.htm\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How To Make Country Wise Website on Same Domain&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":11383,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[271,272,102,276,275,274,273,118],"class_list":["post-11374","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-how-to-make-a-website","tag-make-country-wise-website","tag-php","tag-php-detect-country","tag-php-ip","tag-php-location","tag-php-tutorial","tag-wordpress"],"featured_image_src":"https:\/\/veewom.com\/articles\/wp-content\/uploads\/2018\/10\/Untitled-1.png","author_info":{"display_name":"Editorial Staff","author_link":"https:\/\/veewom.com\/articles\/author\/admin"},"_links":{"self":[{"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/posts\/11374","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/comments?post=11374"}],"version-history":[{"count":1,"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/posts\/11374\/revisions"}],"predecessor-version":[{"id":12597,"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/posts\/11374\/revisions\/12597"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/media\/11383"}],"wp:attachment":[{"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/media?parent=11374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/categories?post=11374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/tags?post=11374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}