Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Build a Simple PHP Application Creating the Menu and Footer Including the Footer and Adding Additional Pages

Oğulcan Girginc
Oğulcan Girginc
24,848 Points

shirts.php = Not Found

When I click to 'Shirts' button, I get the error below:

Not Found The requested URL /shirts.php was not found on this server.

However, when I move the shirts.php file from 'inc' to main directory, I can access to shirt.php.

Does anyone know why this happens?

My header.php:

<?php include('inc/header.php'); ?>

    <div class="section page">

        <h1>Mike&rsquo;s Full Catalog of Shirts</h1>

    </div>

<?php include('inc/footer.php'); ?>

My shirts.php:

<html>
<head>
    <title><?php echo "Shirts 4 Mike"; ?></title>
    <link rel="stylesheet" href="css/style.css" type="text/css">
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald:400,700" type="text/css">
    <link rel="shortcut icon" href="favicon.ico">
</head>
<body>

    <div class="header">

        <div class="wrapper">

            <h1 class="branding-title"><a href="./">Shirts 4 Mike</a></h1>

            <ul class="nav">
                <li class="shirts"><a href="shirts.php">Shirts</a></li>
                <li class="contact"><a href="contact.php">Contact</a></li>
                <li class="cart"><a href="#">Shopping Cart</a></li>
            </ul>

        </div>

    </div>

    <div id="content">

2 Answers

Oğulcan Girginc
Oğulcan Girginc
24,848 Points

Oh! I found the problem: I thought, contact.php and shirts.php was suppose to be under 'inc' folder too. As it turns out, they were suppose to be under the main directory!

Ask and answered by me. Sorry! :)

Quick question, why does your header.php have the following line

            <?php include('inc/header.php'); ?>

That would also be a logic error. It makes no sense to have a file include itself.