{"id":1284,"date":"2022-08-30T15:15:15","date_gmt":"2022-08-30T15:15:15","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/10\/use-of-undefined-constant-dir_include-after-redirect-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:15:15","modified_gmt":"2022-08-30T15:15:15","slug":"use-of-undefined-constant-dir_include-after-redirect-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/use-of-undefined-constant-dir_include-after-redirect-collection-of-common-programming-errors\/","title":{"rendered":"Use of undefined constant DIR_INCLUDE after redirect-Collection of common programming errors"},"content":{"rendered":"<p>I have wriiten a index.php in my root directory(i.e. classroom folder in my case).which is supposed to be the only entry path of my website.<\/p>\n<p>first few lines of my index.php is<\/p>\n<p>index.php<\/p>\n<pre><code> \n        \n    \n<\/code><\/pre>\n<p>the problem is solved when i am including home.html.php in my index.php.but then its not following the url like localhost\/classroom\/home its always remaining as localhost\/classroom.<\/p>\n<p>QUESTION :why this error is coming??how to solve it by keeping the url like localhost\/classroom\/home<\/p>\n<p><strong>EDIT: i think there is some misinterpretation.my question is how can i solve the problem while it will keep the url as localhost\/clasroom\/home&#8230;and if i include all dir definition in every script then same way i will alsso be needed to include session_start() in every script..my question is if i do so will it then hold single entry path concept<\/strong>.because i want to maintain the single entry path<\/p>\n<ol>\n<li>\n<p>Your problem is that you&#8217;re mixing responsibilities. <code>index.php<\/code> should not contain bootstrap events, including that constant definitions.<\/p>\n<p><code>bootstrapper<\/code> should always be separated file, in most cases it should define only common constants and init common variables as well.<\/p>\n<pre><code> \n\n<\/code><\/pre>\n<table width=\"100%\" border=\"0\" cellpadding=\"4px\">\n<tr>\n<td>\n<p>That&#8217;s just a demonstration to make it work. In real-world you should not code this way. Learn about <code>SOLID<\/code> principles, <code>OOP<\/code> and <code>MVC<\/code><\/p>\n<table border=\"0\" width=\"100%\" cellpadding=\"0px\" cellspacing=\"0px\">\n<tr>\n<td class=\"top\"><\/td>\n<\/tr>\n<\/table>\n<\/td>\n<\/tr>\n<\/table>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-10 00:14:19. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I have wriiten a index.php in my root directory(i.e. classroom folder in my case).which is supposed to be the only entry path of my website. first few lines of my index.php is index.php the problem is solved when i am including home.html.php in my index.php.but then its not following the url like localhost\/classroom\/home its always [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1284","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1284","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1284"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1284\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1284"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}