Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Apr 2020
    Location
    Saginaw, MI
    Posts
    1
    Member #
    61557

    Question Directory Root Sub Folder Causing PHP Page Error, I Need A Fix....

    I am new to Web Design, I guess you can say it's a new found love of mine. And yes, I'm novice. So errors seem to be a stable of my journey in learning.

    Anyways, the latest error that is causing me a headache is that I am unable to link to my 'contact.php' page that I have placed in a folder in my Directory Root Folder, that being a Pages folder. When I link to it via my 'footer.php' include file, I get the following error:

    Object not found!
    The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

    If you think this is a server error, please contact the webmaster.

    Error 404
    The following is my 'footer.php' include file:

    HTML Code:
          <footer>
             <a href="pages/contact.php">Contact</a>
          </footer>
       </body>
    </html>
    This is my 'header.php' include:

    HTML Code:
    <!DOCTYPE html>
    <html lang="en" dir="ltr">
       <head>
          <meta charset="utf-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <title><?php echo "$pagetitle";?></title>
          <meta name="description:" content="X">
          <meta name="keywords:" content="X">
          <link rel="stylesheet" href="build/styles/normalize.css">
          <link rel="stylesheet" href="build/styles/global.css">
       </head>
       <body>
          <nav>
             <ul>
                <li><a href="index.php">Home</a></li>
             </ul>
          </nav>
    This is my 'index.php' fale that is not in the Pages Folder:

    HTML Code:
    <?php
       $pagetitle = "Home";
       include "inc/header.php";
     ?>
    
     <?php
       include "inc/footer.php";
     ?>
    This is an image of my Directory:

    I need a fix, any advice?
    Attached Images Attached Images

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,772
    Member #
    5580
    Liked
    723 times
    I see your folder is called "pages" ... but your include is "page/contact.php".

    That's a problem.

    Try: "pages/contact.php"


    Note:
    I would also put "index.php" in the main directory so that if you go to a website without defining a directory, it will automatically load "index.php" by default. Otherwise, you'll be using mod rewrites in .htaccess to find the index file.
    Last edited by mlseim; Apr 13th, 2020 at 07:11 PM.



Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:17 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com