{"id":2297,"date":"2021-09-25T09:43:24","date_gmt":"2021-09-25T09:43:24","guid":{"rendered":"https:\/\/ownwebservers.com\/kb\/?p=2297"},"modified":"2021-09-25T09:43:24","modified_gmt":"2021-09-25T09:43:24","slug":"php-code-to-set-expiration-for-index-page","status":"publish","type":"post","link":"https:\/\/ownwebservers.com\/kb\/php-code-to-set-expiration-for-index-page\/","title":{"rendered":"PHP code to set expiration for index page"},"content":{"rendered":"<p>PHP language is an open source web scripting language that is enclosed inside HTML tags to implement any logic. And several web hosting providers have started deploying PHP hosting servers that are actually known as cPanel hosting servers to host a PHP web site with MySQL to support database of a web site. However due to some reason if you wish to make any changes in your web site so you&#8217;ll be able to set the expiration to your site means that once some date or year your site shows custom error on the page then you&#8217;ll be able to add following code in index page below \u00a0\u201c&lt;?php\u201d the code and as per your request set the date<\/p>\n<p>$exp_date = \u201c2012-04-31\u201d;<br \/>\n$todays_date = date(\u201cY-m-d\u201d);<br \/>\n$today = strtotime($todays_date);<br \/>\n$expiration_date = strtotime($exp_date);<br \/>\nif ($expiration_date &lt;= $today)<br \/>\n{<br \/>\necho \u2018&lt;!DOCTYPE HTML PUBLIC \u201c-\/\/IETF\/\/DTD HTML 2.0\/\/EN\u201d&gt;<br \/>\n&lt;html&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;title&gt;Expired\u2026&lt;\/title&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body&gt;<br \/>\n&lt;h1&gt;What you search&lt;\/h1&gt;<br \/>\n&lt;p&gt;Now Site is Expired &lt;\/p&gt;<br \/>\n&lt;hr&gt;<br \/>\n&lt;address&gt;I have set the expiration to my site ,we need to increase expiration date in index page&lt;\/address&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<br \/>\nexit;<br \/>\n}<\/p>\n<p>This is really easy in which you have to include your index page to get the thing done at correct date but you need a quality web host to host your mission critical web site and web hosting service provider is best from last decade for deploying quality server with up time guarantee and online security.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP language is an open source web scripting language that is enclosed inside HTML tags to implement any logic. And several web hosting providers have started deploying PHP hosting servers that are actually known as cPanel hosting servers to host a PHP web site with MySQL to support database of a web site. However due [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[],"class_list":["post-2297","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v15.2.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PHP code to set expiration for index page - OWS KB<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ownwebservers.com\/kb\/php-code-to-set-expiration-for-index-page\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PHP code to set expiration for index page - OWS KB\" \/>\n<meta property=\"og:description\" content=\"PHP language is an open source web scripting language that is enclosed inside HTML tags to implement any logic. And several web hosting providers have started deploying PHP hosting servers that are actually known as cPanel hosting servers to host a PHP web site with MySQL to support database of a web site. However due [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ownwebservers.com\/kb\/php-code-to-set-expiration-for-index-page\/\" \/>\n<meta property=\"og:site_name\" content=\"OWS KB\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-25T09:43:24+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\">\n\t<meta name=\"twitter:data1\" content=\"admin\">\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data2\" content=\"1 minute\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/#website\",\"url\":\"https:\/\/ownwebservers.com\/kb\/\",\"name\":\"OWS KB\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/ownwebservers.com\/kb\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/php-code-to-set-expiration-for-index-page\/#webpage\",\"url\":\"https:\/\/ownwebservers.com\/kb\/php-code-to-set-expiration-for-index-page\/\",\"name\":\"PHP code to set expiration for index page - OWS KB\",\"isPartOf\":{\"@id\":\"https:\/\/ownwebservers.com\/kb\/#website\"},\"datePublished\":\"2021-09-25T09:43:24+00:00\",\"dateModified\":\"2021-09-25T09:43:24+00:00\",\"author\":{\"@id\":\"https:\/\/ownwebservers.com\/kb\/#\/schema\/person\/4a40fe3fe17a08ddd1d7c113668e75f2\"},\"breadcrumb\":{\"@id\":\"https:\/\/ownwebservers.com\/kb\/php-code-to-set-expiration-for-index-page\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ownwebservers.com\/kb\/php-code-to-set-expiration-for-index-page\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/php-code-to-set-expiration-for-index-page\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/\",\"url\":\"https:\/\/ownwebservers.com\/kb\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/php-code-to-set-expiration-for-index-page\/\",\"url\":\"https:\/\/ownwebservers.com\/kb\/php-code-to-set-expiration-for-index-page\/\",\"name\":\"PHP code to set expiration for index page\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/#\/schema\/person\/4a40fe3fe17a08ddd1d7c113668e75f2\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ba5db5841d48bd7517bb2583e13983e6d2fa56a4099a0b3c61ad2daefc321303?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/ownwebservers.com\/kb\"]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","_links":{"self":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/2297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/comments?post=2297"}],"version-history":[{"count":1,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/2297\/revisions"}],"predecessor-version":[{"id":2298,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/2297\/revisions\/2298"}],"wp:attachment":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/media?parent=2297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/categories?post=2297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/tags?post=2297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}