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

WordPress WordPress Theme Development Building Page Templates in WordPress The page.php File

Marc Cortez
Marc Cortez
2,977 Points

Object not found! Error 404

Hey people,

I did exactly the same as Zac, when creating the page.php. I have the problem, that somehow, my localhost throws me following message:

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

localhost
Apache/2.4.10 (Unix) OpenSSL/1.0.1j PHP/5.6.3 mod_perl/2.0.8-dev Perl/v5.16.3

Does it have something to do with my local machine?

My page.php looks like this:

<?php get_header(); ?>

<section class="nine columns content">

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

        <h2><?php the_title(); ?></h2>
        <hr>
        <p><?php the_content(); ?></p>

    <?php endwhile; else : ?>
        <p> <?php _e( 'Sorry, no pages found.' ); ?></p>
    <?php endif; ?>

</section>

</div>

<?php get_footer(); ?>

Please help!

Gary Calhoun
Gary Calhoun
10,317 Points

When you deal with local builds you have to mess with changing the port number in config files sometimes. I personally use Microsoft Web Matrix for wordpress local testing and never had any issues it's easy to set up and just works for me at least. That could definitely be why its giving you that problem. Hope it helps!

Marc Cortez
Marc Cortez
2,977 Points

Hey Gary,

thanks for the hint! I forgot to add the .htaccess file and configure it!

Gary Calhoun
Gary Calhoun
10,317 Points

Ahh ok , i knew it had to be something along those lines. Glad to help nonetheless!

Jeremy Castanza
Jeremy Castanza
12,081 Points

Try resetting your permalinks. Any reset to permalinks should automatically update your .htaccess file if you're in an Apache environment. Microsoft servers don't typically use .htaccess that's probably why Gary hasn't had this issue.