treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] Changing permalinks on fresh WP install won't work

  • This might sound like a real newbie problem but.. I'm relatively new to WordPress and working my way through Chris's book at the moment. After setting up a new database and installing WordPress (3.0.3) I took his advice and changed the permalinks right away to a custom structure, I'd like to use: /%category%/%postname%/ , however the internal links break when I change to this (or to any other structure). When I change it back to the default permalink setting it works fine. I thought that as it was a fresh install/database that WordPress would resolve all of the links to the correct place, but it doesn't seem to, I just get a 404 error.

    Anyone got any ideas? I've already tried deleting the .htaccess file from the WP root directory, but to no avail.

    Many thanks in advance!
  • I remember this problem... now, do I remember the solution? Not off the top of my head... I know if you are using a Windows server, you cannot have a permalink structure like that, so check with your hosting, because that would throw a 404 error.

    I feel like there's some other issue though... I can't remember what it is.
  • Does Wordpress tell you that it wrote to the .htaccess? or does it give you a read out of how it should look?

    If it is the latter then copy/paste that into the .htaccess manually, otherwise I'm stumped.
  • Thanks for the replies guys.

    @TheDoc, I'm developing the site for the company I work for so I'll have to check with the guy who deals with the hosting to find out whether or not it's possible. Thanks for the advice though, if anything else comes to mind then let me know!

    @clokey2k, it doesn't tell me that it wrote to the .htaccess, it simply says 'Permalink structure updated' once I save changes. When I create a new post it tells me that it's permalink is 'http://localhost/ax/category/postname/' which is what I want, however when I go to that page it throws a 404 error at me. The .htaccess file is currently as follows:


    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /ax/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /ax/index.php [L]


    # END WordPress


    I'm not too proficient in editing this file, I tried replacing the last Rewrite Rule to read RewriteRule . /ax/%category%/%postname%/ [L] but that didn't help. (ax is my WordPress root directory). Can you advise me on how I should edit this file?

    Many thanks in advance again, I really appreciate you guys' help on this.
  • localhost - chances are the rewrite module is switch off in a default WAMP / MAMP installation. That may be the cause, but I do not know how to 'switch it on' - but this guy seams to: http://www.anmsaiful.net/blog/php/enable-apache-rewrite-module.html
  • Hey thanks so much, that was indeed the problem. I edited the apache config file as the chap in your link directed and it's now rewriting perfectly! I owe you one! Thanks!!