WordPress.org

Ready to get started?Download WordPress

Forums

Prefix and permalinks problem. (11 posts)

  1. milosz
    Member
    Posted 7 years ago #

    Hello WordPress community :)

    I'm realy new here, just instaled wordpress :) Great to use such a simple yet powerful script. Still, beside of that, I have little problem, that I couldn't solve by myself. I thought that someone from You, expirienced wordpress users, could help me.

    I'll try to describe my simple problem briefly. I set permalinks like that:
    "category/%category%/%postname%.html"
    and category viewer like that:
    "/category"

    and after clicking on post title I get 404 error. I think that using "category" word 2 times is causing that. But I've been bloging for about 3 years and my readers and I are used to category/%category%/%postname%.html ; /category/%category%/ structure.

    Could someone help me? I've tried to search for similar problems ( "prefix permalinks 404" ) but I didn't find answer.
    I'm sorry for my english. And thanks in advance for time spend reading this :)

  2. Chris_K
    Member
    Posted 7 years ago #

    Check the troubleshooting sections at the Permalinks page.

    In particular, make sure your host has mod_rewrite and AllowOverride properly set and enabled.

  3. milosz
    Member
    Posted 7 years ago #

    Thank for quick answer :)

    Checked - I have everything set and ready to "blog".
    My host has it enabled.

    Everything works great - every rewrite rule, *until* I use 2 same words in permalinks AND category viewer:

    "category/%category%/%postname%.html"
    "/category"

    Is there any fix for that ? Should I *do* something, some code changing, or something ?

  4. milosz
    Member
    Posted 7 years ago #

    It occurs always when I use 2 same words for permalinks and category viewer. I've just checked this - 5 different names, same result. 404 after clicking on post.

  5. Chris_K
    Member
    Posted 7 years ago #

    Ah. Sorry, I hadn't picked up on the "category/%category%/%postname%.html" thing.

    Afraid I have not great ideas (hopefully someone else will), but I have a question: Out of curiosity, what's the rationale for that?

  6. milosz
    Member
    Posted 7 years ago #

    3 years habit :)
    I didn't find anything that could solve the problem. Please can anyone help here ?

  7. milosz
    Member
    Posted 7 years ago #

    anyone ?

  8. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    The problem is not solvable with the way WordPress works. It would take a fairly major redesign of the rewrite system.

    The short solution: Don't do that.

  9. milosz
    Member
    Posted 7 years ago #

    :( So there isn't any way to do that? It would be only 2 lines of code in .htaccess :

    # [wrodpress] post
    RewriteRule ^category/(something|something2|something3)/([_0-9a-z-]+).html(/?)+$ ?category=$1&title=$2 [QSA,L]

    # [wrodpress] category
    RewriteRule ^category/(something|something2|something3)(/?)+$ ?category=$1 [QSA,L]

    Ofcourse if wordpress uses above variables, or hides them... Eh... That is not good :(

  10. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    WordPress does not work that way.

    You may be able to work out some way of doing it using .htaccess rewrites. But you will not be able to do it in WordPress alone. Not everything you can type in for the permalink structure will actually work. This is one of those things that won't.

    WordPress recognizes elements in the URL that cause it to know what kind of posts to retreive. Right now, you're wanting to having it recognize two different contradictory things. You want it to see URLs that start with "category" and think that they are category archive pages, but you also want it to recognize that things starting with "category/something else" is a single page (which is *NOT* a category archive page).

    In other words, you've got two matches. How does it know that "category/some-cat/post-title" is a URL for a single post vs. a category archive of the some-cat/post-title categories (nested)? It can't figure that out. It's not smart enough.

  11. milosz
    Member
    Posted 7 years ago #

    Eh... I already now how wordpress works :) After 2 years of co developing news script ( strawberry ), I wanted to start using something a bit more friendly that I have right now. I've just thought that wordpress will be just the thing :) but it won't. Maybe in some new release.
    I just can't change adresses of nearly 12.000 posts.

Topic Closed

This topic has been closed to new replies.

About this Topic