dakat Posted November 15, 2010 Report Share Posted November 15, 2010 Hello, I purchased the class "building a simple WordPress theme" by Jon Lebensold. I was going by order of the class. I am now in part 4: "The wordPress loop". Jon teaches here in 6:19 [after 6min and 19sec] how to avoid the message: "The requested URL "/wordpress/<anything>" was not found on this server". If I type in the URL "http://localhost/wordpress", I get the page to display the correct content [as per Jon's class]. However, if I type: "http://localhost/wordpress/<anything>", I get the error that the page can not be found even though I wrote all the code Jon teaches us including changing the permalink settings [according to what Jon tought]. I even took the index.php that came with the class and replaced with mine. Still same error. I have the latest wordpress and I am using WAMP. Everything was working according to the class until this point. Please let me know how to fix this and have the ability to avoid this error. Thank you, Danny Quote Link to comment Share on other sites More sharing options...
dakat Posted November 15, 2010 Author Report Share Posted November 15, 2010 This is what the class tells us to put (but as I wrote, it doesn't work): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS feed" href="<?php bloginfo('rss2_url');?>" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" /> <?php wp_head(); ?> </head> <body> <div class="canvas" <div class="header" <h1> <?php bloginfo('name'); ?> </h1> <h2> <?php bloginfo('description'); ?> </h2> </div> <div class="content" <?php if (have_posts()): ?> <h2>Have posts</h2> <?php else: ?> <h2>Not Found</h2> <p>Sorry I can't find what you are looking for</p> <?php endif; ?> </div> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
falkencreative Posted November 15, 2010 Report Share Posted November 15, 2010 Unless I am misunderstanding you, when you type in a URL to a page that doesn't exist, you should get a "Not Found" page. According to your code above, you should get a Wordpress themed page with a "Not Found" header and "Sorry I can't find what you are looking for" just below that. What are you currently getting? Where are you putting the code above? Usually, that would be split up into a header.php and footer.php file for the header/footer areas, and the main content section would go within index.php. I haven't done that particular series in a long time, so I'm not sure where the tutorial tells you to put the code. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted November 15, 2010 Report Share Posted November 15, 2010 Also, I just noticed that you have three divs that don't have a proper closing ">" character on them. That may also be a source of an issue: <div class="canvas" <div class="header" <div class="content" Those need to look like this: <div class="canvas"> <div class="header"> <div class="content"> Quote Link to comment Share on other sites More sharing options...
dakat Posted November 15, 2010 Author Report Share Posted November 15, 2010 I fixed the divs, but I am still getting the same error: "Not Found The requested URL /wordpress/dsfsd was not found on this server". Quote Link to comment Share on other sites More sharing options...
Andrea Posted November 15, 2010 Report Share Posted November 15, 2010 You might be misunderstanding what Jon's saying - this is not about avoiding a page not found (what else should you be getting if a page does not exist?) - it's about creating that page-not-found page. Quote Link to comment Share on other sites More sharing options...
dakat Posted November 15, 2010 Author Report Share Posted November 15, 2010 When I type a URL to a page that doesn't exist, I should get a "Not Found" page. According to the code (and the class in the DVD), I should get a Wordpress theme page with a "Not Found" header and "Sorry I can't find what you are looking for" just below that. I keep getting "The requested URL /wordpress/dsfsd was not found on this server". In the class, it does not work for Jon as well, until he fixes the permalink. I did that, but I still get the same. What am I missing? Quote Link to comment Share on other sites More sharing options...
falkencreative Posted November 15, 2010 Report Share Posted November 15, 2010 I'll take a look at this later today. I know Wordpress has gone through several revisions since those tutorials were recorded, so I will double check if it somehow has to do with a version incompatibility. It should work though... I'm not seeing anything in your code that should cause an issue. Which file did you place that code that you posted above in? Quote Link to comment Share on other sites More sharing options...
dakat Posted November 15, 2010 Author Report Share Posted November 15, 2010 The file was index.php [as per the class]. It is in "building a simple WordPress theme" by Jon Lebensold, part 4, after 6m:19s. Quote Link to comment Share on other sites More sharing options...
Andrea Posted November 15, 2010 Report Share Posted November 15, 2010 I just did a new Wordpress template following Jon's tutorial and the page works for me - it's at aa ndbwebd esign.com/pets - the code on my page.php looks like this: <?php get_header(); ?> <div id="content"> <?php if ( have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div id="page"> <?php the_content('Read more....'); ?> </div> <?php endwhile;?> <?php else: ?> <h2>Not Found</h2> <p>Sorry, I can't find what you're looking for.</p> <?php endif; ?> <?php if (is_page('Home')) : ?> <div id="homesplash"> <img src='whatever/> </div> <? endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?> Hopefully, comparing that to your code will help? Quote Link to comment Share on other sites More sharing options...
dakat Posted November 15, 2010 Author Report Share Posted November 15, 2010 I copied your code and I get the same problem. If I go to: "/localhost/wordpress" I can see the content [just as with the code Jon provided]. However, if I go to "/localhost/wordpress/blablabla", I get an error that the page can not be displayed, instead of "Sorry I can't find what you are looking for". I am thinking it is either a setting problem [in Wordpress (or maybe Firefox)] or maybe it is because I am using WAMP [windows based sever] and not MAMP [Mac based server], which is what Jon is showing and using in class. In any case, the loop never goes to the 'else statement' for whatever reason. It only goes to the 'if statement'. Quote Link to comment Share on other sites More sharing options...
Andrea Posted November 15, 2010 Report Share Posted November 15, 2010 Sorry, I can't help with that. I've never worked with WAMP and only know PHP enough to copy and paste it. Quote Link to comment Share on other sites More sharing options...
dakat Posted November 16, 2010 Author Report Share Posted November 16, 2010 I would guess that it is some sort of a Wordpress settings issue. In the class, Jon also gets my error, but he shows how to fix it through Permalinks. In my case, that did not fix it, so there is probably another settings fix somewhere in wordpress. I just do not know which one it is. If someone can help me that would be great. Quote Link to comment Share on other sites More sharing options...
Andrea Posted November 16, 2010 Report Share Posted November 16, 2010 My last site was build with the latest Wordpress version, and I mostly use Firefox, and I am not on a MAC, so none of those factors are the cause. I have no idea if WAMP could be an issue, but I actually think Jon's working on localhost as well. My index.php looks like this: <?php get_header(); ?> <div id="content"> <?php if ( have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post"> <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> <h2><?php the_author(); ?></h2> <?php the_content('Read more....'); ?> </div> <?php endwhile;?> <div id="postNavigation"> <div class="alignleft"><?php next_posts_link('> Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries <') ?></div> </div> <?php else: ?> <h2>Not Found</h2> <p>Sorry, I can't find what you're looking for.</p> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?> I've build 3 sites so far following Jon's tutorial using probably 3 different Wordpress versions - whatever was the latest at the time I build my site, and all my not found pages work. Unfortunately, I don't understand the deeper workings of Wordpress to be able to troubleshoot this one - especially, since we can't even see the entire thing. Quote Link to comment Share on other sites More sharing options...
dakat Posted November 16, 2010 Author Report Share Posted November 16, 2010 I think I figured out the problem, but I did not figured out the solution, and this is where I need assistance. I erased wordpress and the DB and all the new site that Jon was teaching. I reinstalled wordpress. This is the problem I noticed: When my permalink is at default: http://localhost/wordpress/?p=123, I am able to view the site [http://localhost/wordpress/] and successfully click the tabs [about, author, etc' ...]. However, when I change the permalink to any other setting, I am still able to go into the main site [http://localhost/wordpress/], but the minute I click any tab, it comes back with an error: Not Found The requested URL /wordpress/about/ was not found on this server. This is the same error I originally complained about! I went through Stefan's class 'word press config part 3' [which is free]: "http://www.killersites.com/wordpress/videos/config-wordpress-29-part3.php", and after ~6min, he says there that in order for the permalinks to work, a file by the name of .htaccess needs to be created and edited. This is my .htaccess [which was created automatically by WordPress]: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /wordpress/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wordpress/index.php [L] </IfModule> # END WordPress Any suggestions of what do I need to do in the file (or elsewhere) to fix this problem? Thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.