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

Colton Plumley
Colton Plumley
4,468 Points

permalink settings

My pages generate when the permalink settings is set to default; however, when I change the setting to any of the others the links break and I receive a 404 message. I cannot find any possible solutions. Any one know what is going on?

4 Answers

I am also having this same problem and have applied the .htaccess fix to no avail, any other guesses as to why this is not working?

Bryan Lam
Bryan Lam
15,592 Points

If you are using WAMP or XAMPP, be sure to enable the 'rewrite_module' in the Apache settings. Even if you have the .htaccess file set up, it won't work until you enabled Apache to do the rewrite of the urls.

Bryan Lam , thanks .

Wild guess here, but I'll bet your .htaccess file is missing. Download this file and place it in the root WordPress folder (so, right next to wp-config.php, wp-login.php, xmlrpc.php, and all those other files). If it doesn't work, come back and and we'll try to debug it more together. :)

Colton Plumley
Colton Plumley
4,468 Points

I am still receiving the same error code. I have put the .htaccess in the root wordpress folder as shown:

{{$Username}}$ ls -a
.                           wp-admin                          wp-links-opml.php
..                          wp-blog-header.php            wp-load.php
.DS_Store                   wp-comments-post.php              wp-login.php
.htaccess                       wp-config-sample.php              wp-mail.php
index.php                   wp-config.php                 wp-settings.php
license.txt                 wp-content                        wp-signup.php
readme.html                 wp-cron.php                       wp-trackback.php
wp-activate.php     wp-includes                       xmlrpc.php

I copied the .htaccess file exactly as it was in the dropbox. Any other ideas? Also, let me know if you need me to post any code!

Try visiting the root of your site (the homepage). Does that return a 404 as well?

Colton Plumley
Colton Plumley
4,468 Points

The root of the site shows me the static homepage I set up. I can change the static page to any of the pages I have created and it displays the content, but when I go to localhost/~Username/Sites/wordpress/any_of_the_pages_I_have_set_up it returns the 404 code. Same thing when I click the view page link under each page.

Can I get a screenshot of the site root, and also of one of the pages that isn't working? If you can't for whatever reason, no big deal.

Hi Ryan,

I tried using the file you linked to. It was pointed out to me by my web hosting provider (upon contacting them for support) that the htaccess file was suppose to be named .htaccess, with a period in front of it. Without this period my wordpress site was not reading the file, and hence the fix was not working. upon adding the period in front of it, everything works fine. Not sure if Colton was ever able to get past this, likely he was, but if not or if there are others in the same pinch, downloading this file and then renaming it so it starts with a period may work.

Hot Bricks Employee
Hot Bricks Employee
10,991 Points

@Kyle Binger -- did you copy the new text from the bottom of the permalink page and paste that in your .htaccess file?

I was having the same problem and after searching realized this is what I had to do for my permalink pages to display.

Ekramy M.Ali
Ekramy M.Ali
17,748 Points

I'm using wamp so I enabled rewrite_module in the Apache setting and the problem solved .