WordPress.org

Ready to get started?Download WordPress

Forums

Edit Permalink Structure problems (22 posts)

  1. kcoombs
    Member
    Posted 9 years ago #

    Hi,

    I've been trying to use the Edit Permalink Structure page under options to create a different structure for my permalinks. However, when I put any of the suggested structures it breaks all the navigation links (archives, catagories) on my site. It also breaks the links to the RSS feed. I'm using WordPress 1.5. I tried the method where you need to add things to your htaccess file and the one where you don't but neither work. Can anyone help me?

    My blog is at http://www.librarywebchic.net

    The links are working right not because I don't have the custom permalink structure turned on.

  2. Kafkaesqui

    Posted 9 years ago #

    Are you sure mod_rewrite is enabled on your server? Here's a simple .htaccess you can use to test it:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^home/$ /index.php [L]

    With this, if home/ goes to index.php, it's working. If not, contact your provider to see if they allow it/can turn it on, etc.

  3. gleem
    Member
    Posted 9 years ago #

    I have the same problem, and I use htaccess in several other domains of my server.

    when activated links break about 50% of the time

  4. Kafkaesqui

    Posted 9 years ago #

    If it's an off and on issue, see this post for one possible fix (originally for another issue, but you never know which problems are related):

    http://wordpress.org/support/topic.php?id=24402

  5. kcoombs
    Member
    Posted 9 years ago #

    The problem isn't an off and on issue and mod_rewrite is enabled because I have other rewrite rules that work. Also, I've tried setting it up using the method that doesn't require mod_rewrite and that doesn't work either. I haven't the foggiest what I am doing wrong.

    Are there issues depending on where WordPress is located on the server?

  6. thinkeric
    Member
    Posted 9 years ago #

    Boy, I'm right there with you. This has been driving me crazy all morning. I'm also trying to get the permalink structure set, this is my goal:

    /%category%/%postname%/

    However, I run into the same 404 issue as described. Trying to troubleshoot a bit, I have been successful with the following:

    /%postname%/

    Just the permalink.

    /archives/%postname%/

    Where I set the category name manually.

    /%monthnum%/%post_id%/

    Two directories generated, including using post_id instead of postname.

    In these situations, I am able to go directly to a link without the 404. All hell breaks loose when I invoke the /%category%/ variable, is there somethink I am missing here?

  7. thinkeric
    Member
    Posted 9 years ago #

    The saga continues. As a follow-up, I'm also unable to get %author% to work.

    /%author%/%post_id%/

    Returns the following URL:

    www.mysite.com//02/

    Obivously, 404 material. For some reason, the variable isn't getting placed here.

  8. thinkeric
    Member
    Posted 9 years ago #

    Just found the answer to the category issue...

    http://wordpress.org/support/topic.php?id=26870

  9. thinkeric
    Member
    Posted 9 years ago #

    AHA!

    After initial attempts at getting the Ungreedy plugin to work, I took a look at the php code, trying to figure out what the script actually did. Here's the fix, your htaccess file must be edited manually.

    When using the %category% tag in your permalink manager, here's how the htaccess file is written... the last nine lines look something like this:

    RewriteRule ^(.+)/page/?([0-9]{1,})/?$ /index.php?category_name=$1&paged=$2 [QSA,L]

    What you need to do is replace that first (.+) with ([_0-9a-z-]+), so that each line looks similar to this:

    RewriteRule ^([_0-9a-z-]+)/page/?([0-9]{1,})/?$ /index.php?category_name=$1&paged=$2 [QSA,L]

    Once I did this, I was able to eliminate the 404s. Credit this post for the help:

    http://boren.nu/archives/2005/03/07/reduced-rewrite-plugin/#comment-233

  10. kcoombs
    Member
    Posted 9 years ago #

    Okay I'm really frustrated now. I can't seem to make this work correctly. I've even tried the following permalink structure
    /index.php/%year%/%monthnum%/%day%/%postname%/

    This is supposed to work regardless of if mod_write is installed.

    From what I can tell my site is on a server running Apache 2.0.46

    Does anyone have other suggestions?

  11. mahadewa
    Member
    Posted 8 years ago #

    Thinkeric, thanks ... your fix work for me.

  12. mahadewa
    Member
    Posted 8 years ago #

    Well, not exactly :( As soon as I write another post and save it, WP re-writes .htaccess back to the original.

  13. fromedome
    Member
    Posted 8 years ago #

    The manual .htaccess modification mentioned by thinkeric is the only thing that has been able to solve my /%category%/%postname%/ problem as well. Yet, as mahadewa says, every time I do anything significant with WP, .htaccess reverts to broken mode.

    Is there any way to make this .htaccess modification permanent (or at least persistently update those 9 lines), through a plugin or hacking part of WP that writes to .htaccess?

    If that sounds like a rhetorical question with a simple (but nonetheless disappointing answer -- "not yet!"), it's meant to be. But seriously, WP's future as a legitimate CMS depends on this sort of functionality.

  14. webscriptz
    Member
    Posted 8 years ago #

    is just never workt

  15. bitweever
    Member
    Posted 8 years ago #

    Hi folks, I'm new here. Thinkeric's solution worked for me, and I wanted to make it permanent. The code that writes these rules for .htaccess is in /wp-includes/classes.php. Look for 'class WP_Rewrite', and the definitions start from there. There's four arrays defined before the first function. You should be most concerned with '$rewritereplace'. This corresponds directly to '$rewritecode' above it. In my install (1.5.1.2; I'm not sure if it's different for 1.5.0 or 1.5.1), category is the 9th item in the array. I changed that from '(.+?)' to '([^/]+)' and it works fine now...

    ...except for one thing. On the indiviual post pages, the text of the post isn't showing up. I think it has something to do with the_content() reading the URL, I'm not sure.

  16. bitweever
    Member
    Posted 8 years ago #

    ... except this breaks sub-categories. Sorry about that.

  17. cchurch
    Member
    Posted 8 years ago #

    Is it not true that .htaccess is a non-Windows/IIS server necessity? If so, that should be made clear in posts like this on modifying permalink structures, etc.

  18. James
    Happiness Engineer
    Posted 8 years ago #

  19. cartermason
    Member
    Posted 8 years ago #

    My post URL's are working great. I just ported over a blog from b2evolution, and all's well. I didn't have a single URL change...

    But I just tried to create a static page through WP's admin, and the URL doesn't work. All the other pages have the correct URL structure, but not the static pages. Has any one else encountered this?

    Oh, and for those of you having the problem of WP rewriting your .htaccess and breaking it all over again... delete your .htaccess from the server and then reupload it. Or change the permissions manually and make it not writeable.

  20. petrenkocomua
    Member
    Posted 8 years ago #

    thinkeric, I have the same problem. But Apache 2.

    http://wordpress.org/support/topic/51587#post-284077

  21. jtuomi
    Member
    Posted 8 years ago #

    I have the same problem with the static pages. When I started I had the "default permalink structure", and I could write and save one page.

    Then I started fiddling with my permalinks, and finally did get them into a form that pleases me (or my eye, rather). But now only the first statc page works. Whenever I try to write and save a static page, and then go to my blog, and click on it, I will get a "page not found" error.

    I know, most certainly, that if I go back to the original permalink structure, I will get the static pages working, but I so much like my permalinks now...!

    The URI to my blog is http://www.squash.nu/blogi

  22. cartermason
    Member
    Posted 8 years ago #

    Success!

    Okay, this is a pain in the butt... but it works!

    I have a modified .htaccess file, and I can't allow WP to modify it, because it breaks my site every time it updates it. I'm guessing that you who are having the permalink static page problem also do not have WP automatically updating their .htaccess. So...

    What fixed this problem of static pages not working with permalinks, I just had to resave my settings and then cut and paste the new .htaccess code from the permalinks page into my .htaccess file, upload, and then voila! The page works...

    If I figure out how to make it so the automatic updating of .htaccess doesn't break my site, I'll report back to this thread and let y'll know if that also fixes the static page permalink issue.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.