• Resolved skepticwebguy

    (@skepticwebguy)


    I am using the following permalink structure on my wordpress 2.8 blog:

    /%category%/%postname%

    so that my urls look like:

    domainname.com/categoryname/post-slug

    What’s weird is that this permalink structure will allow me to replace categoryname with ANY word I want and it still works! For instance, I can change the above example to the following and it will still load the right post:

    domainname.com/whatever/post-slug, or
    domainname.com/whatever/whatever/post-slug, or
    domainname.com/whatever/whatever/whatever/post-slug

    You get the picture. I don’t think this is a good thing. Ideally, the above three URLs should lead to 404 pages, but they don’t.

    My htaccess file has the following in it:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    Also, if I have my Reading settings set to show only 5 posts per page, the above permalink structure causes a 404 error when I click the “Older Entries” link to see the next 5 posts. For example:

    domainname.com/categoryname/page/2

    leads to a 404 error, yet,

    domainname.com/page/2

    works just fine. So, it means that I have to set my READING settings to show all my posts on one long scrolling page. Not good!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter skepticwebguy

    (@skepticwebguy)

    is anyone else having this problem?

    Yes! I’ve got this problem too.

    Perhaps it’s got something to do with the awful hacks I’ve had to do to get rid of the ugly default permalink structure : domain.com/category/category_name/post_title

    I found something on a site that suggested a str_replace ‘category’ with ” in category-template.php, can’t remember where exactly. Anyway, I did this and I was able to use the nicer : domain.com/category_name/post_title without the Older/Newer links errors as you are having…

    Now! I’ve just discovered that domain.com/absolutely_anything_here/post_title works! Argh!

    Maybe it’s because of the tweaking I’ve done. I’m going to revert back to default, see if the problem is there (hoping it won’t be) then try again. I’ll post here if I manage it.

    UPDATE : fresh install, domain.com/absolutely_anything_here/post_title still doesnt show a 404.

    Initial reaction, WordPress is a bit **** isn’t it. ??

    Ok, Solved!

    I’ve started a fresh, I’m using the nice /%category%/%postname% permalink but I’m still getting the idiotic /ANYCONTENT/postname problem.

    This is not good, hey search engines, my site is full of infinite duplicate content!

    I suspect this is an actual wordpress bug. Oops.

    The only solution I can find is to install some plugin that checks that the url fields match with the WP content! If not, it throws a 301 redirect to the correct page (I might alter it to throw a 404) It’s here : https://scott.yang.id.au/code/permalink-redirect/

    As for the error navigating newer/older links : I found this works,

    updated! new url :

    https://www.themadhat.com/blogging/remove-category-base-wordpress/

    Thread Starter skepticwebguy

    (@skepticwebguy)

    thanks. I just came back to update my own post and provide the solution I found — and I see you already found the same solution!
    https://scott.yang.id.au/code/permalink-redirect/

    I found that this fixed my newer/older link navigation too!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘category/postname permalinks work even when category name is not a category!’ is closed to new replies.