Make WordPress Core

Opened 16 years ago

Closed 15 years ago

#889 closed defect (bug) (worksforme)

Post Permalink do not work

Reported by: DarkCryst Owned by:
Milestone: Priority: normal
Severity: major Version: 1.5
Component: General Keywords: bg|2nd-opinion bg|dev-feedback bg|reporter-feedback
Focuses: Cc:


using the final release of 1.5, fresh install, upgraded form old database.

None of the post specific permalinks work. All I've done is set them up in the options, nothing fancy - kind of worrying as this is live on my main blog now.

Change History (24)

#1 @DarkCryst
16 years ago

  • Patch set to No

#2 @DarkCryst
16 years ago

It seems to throw a wobbly on my structure - category/year/post_name

I remove the category and it works FINE.. which sucks because I specifically wanted category. Guess its a bug in the rules generation then...

This is totally reproducable btw.. its just this rule that kills it. Going to play some more and see if I can get more info.

#3 @DarkCryst
16 years ago

Confirmed - only when I insert the category permalink anywhere in my structure does it die.

#4 @ryan
16 years ago

Are you using Apache 1.3? mod_rewrite in apache 1.3 has some problems with the regular expression used for the %category% tag. You can work around it by using these <a href="http://boren.nu/archives/2004/10/08/alternative-rewrite-rules/">alternative rules</a>.

#5 @DarkCryst
16 years ago

I am using 1.3 yes. I don't know of any hosts that have 2.0 as a basic package. AFAIK 1.3 is still the most popular install? Anyhow.. moving on...

Using those rules changes things, but still doesn't work. It just ends up removing the error code (from "404 not found" to just "not found"). Same result. It is just the posts that die on this - their links, no others. For example mysite.com/category/ will work.

So yeah, still broken. I'm "fixing" it by not using categories atm, but that sort of screws over my site plans. Its really wierd because it USED to work earlier in the nightlies... not sure what was changed, but its worse.

edited on: 02-16-05 20:17

#6 @anonymousbugger
16 years ago

Delete your .htaccess file and recreate the permalinks. And please use the Support Forums next time.

#7 @DarkCryst
16 years ago

as far as I'm concerned its a bug - the links do not function on a CLEAN install.

I have tried deleting the .htaccess does nothing.
Changing the rules, does nothing.

This is something that *was* working in a previous, and is now broken. Hense.. its a bug. I am using a standard sever, and have done nothing wierd. Yet its not working. I searched the forums FIRST and tried everything that was mentioned there. No luck. Ryan's access rules were there, but seemingly that was a different issue.

In short I'm reporting a bug in a bugtracker. Also if the default WP 1.5 install needs apache 2 for its basic functionality to work.. thats ALSO a bug as far as I'm concerned. Especially when it worked before.

#8 @ryan
16 years ago

%category% did not exist in 1.2.2 so this is not a regression. It may have worked for you for awhile in the nightlies with the old %category% regular expression, but that regular expression broke i18n support and other things. You can either change the regular expression to suit your needs or use the alternative rules I mentioned, which do work. I can help you get those rules working if you like. mod_rewrite in older versions of apache has serious problems that are painful to work around in a generic manner. %category% just won't work out of the box with older mod_rewrite and its greedy matching problems. Such is life.

#9 @DarkCryst
16 years ago

Yes, I should have been clearer - it was in the old nightlies that it worked, not 1.2.

I'd be happy for you to get those rules working, because they don't seem to for me. Its not rocket science, but its not working as read. At least the problem is confirmed as a "won't fix" type bug - I understand the problem with i18n support and can see why that would take priority. I would say that a note in the permalinks screen would make sense - else you'll get this pointed out over.. and over.. and over again.

I'd be glad for the help as it is driving me nuts - Darkcryst@…

#10 @ryan
16 years ago

We can try the alternative rules again. So, we have this:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.+)$ /index.php/$1

If your Blog Address is http://example.com/wordpress/, for example, then RewriteBase needs to be /wordpress/ and the path to index.php needs to be /wordpress/index.php/$1. If your Blog Address is http://example.com/, then you should be able to use those rules as is.

Remove all rules from .htaccess and insert the above rules instead. This method requires that AcceptPathInfo be turned on. If the rules aren't working for you, try adding this to your .htaccess as well.

<Files "index.php">
AcceptPathInfo On

Of course, AcceptPathInfo is only supported by Apache 2.0.30 and above, so if your host has path info turned off, you can't change it. If you are in this situation, you'll need to make some tweaks to the rules written by WP. Wherever you see "(.+)" replace it with "([_0-9a-z-]+)". This regular expression assumes you speak english. ;-) After you make this change, change the permissions on .htaccess so that it is not writable, otherwise WP might stomp your rules. I'll write a plugin that will automatically create the rewrite rules needed by english speaking, %category% using, Apache 1.3 users. With that plugin installed and activated, you can leave your .htaccess writable and WP will write the correct rules for you. I'll try to write it in the next couple of days.

edited on: 02-17-05 00:04

edited on: 02-17-05 00:05

#11 @DarkCryst
16 years ago

Tried these rules again, and they still don't work. Or rather, they don't fix the issue.

They are now the only thing in my htaccess. It works fine as before - until there is category in it. I only have Apache 1.3, so the other half of the instructions don't work (in fact causes a 500 server error).

Basically while these rules are simpler, they don't solve the category bug, they also remove the ability to get error codes. *sighs* Basically there is no way to get this functionality "out of the box" with WP on Apache 1.3 correct?

Would it not make sense for there to be an option in permalinks to change the permalink generation to the ([_0-9a-z-]+) style? Else really the requirments should be changed to Apache 2.0 - without it WP is much more limited (categories allow all sorts of useful flexibility).

To summarise: ([_0-9a-z-]+) fixes it, nothing else did.

#12 @DarkCryst
16 years ago

Any update on that plugin to fix this issue - I'd like to add another problem to this - the fix with changing to ([_0-9a-z-]+) doesn't quite cut it - you cannot have two categories (eg general/ works but not general/website/)

Basically the categories permalink feature is broken in 1.5 to most webservers and sites. Apache 2 is hardly common. This is... frustrating. I'm sure there's a fix, but its annoying.

#13 @anonymousbugger
16 years ago

on apache1, i edited file wp-includes/classes.php, and change rules' start from "RewriteRule " to "RewriteRule /"' and it works fine.

#14 @anonymousbugger
16 years ago

I'll echo DarkCryst's comments that these suggestions do not work. Either nothing happens (still displays "sorry, no post...") or a 404. Tried each of the modifications suggestion, but still category permalinks are not possible (for me) with 1.5 as they were with the earlier betas. ;-(

#16 @anonymousbugger
16 years ago

Sorry to report that neither approach works. I'm beginning to suspect I might have something that's limiting what shows, so I deactivated the rewrite plugin and changed the permalinks to year/month/etc., and posts display just fine. Change back to /archives/%category%/%postname%/ (and also tried it without the /archives) using both plugins (not at the same time) for rewriting and nothing. Still get "Sorry, no post..."

But thanks for the help. I'm giving up on this, and will instead write several pages of redirects to handle the old (now heavily googled) category permalinks from the 1.3 version to redirect to what I have to live with without a category permalink. Sucks, but I have no choice.

edited on: 03-09-05 16:30

edited on: 03-09-05 16:31

#17 @DarkCryst
16 years ago

Yup, got to agree - the plugins work fine, but they don't fix this problem at all.

Its not like its just one server this is happening on either. 4 different servers (admitedly - only two different companies) do this to me.

I think it needs to be acknowleged that this is very broken in 1.5, in fact not even useable. Its wierd, really really wierd.

#18 @ryan
16 years ago

Bottom line: %category% is not compatible with mod_rewrite versions using POSIX regular expressions. Even the ungreedy rules will still get tripped up by the '/' needed for subcategory support. If you can live without subcategories, you can eliminate the '/' from the ungreedy version of the %category% regular expression.

The Reduced rules should work, however. They redirect to WP which uses PHP's PCRE regular expressions which are made non-greedy with the reluctant modifier. Does the reduced rewrite plugin not work for any of your permalinks, or only those which have category/postname?

#19 @DarkCryst
16 years ago

The reduced set works fine until I put %category% in there.
the ungreedy set works fine... until I put %category% in there.

categories without subcategories slightly (not totally) kills the point of categories. Its not like I can set it to just include the root category in the permalink - and a sensible structure means subcategories for the most part.

I wish I could be more help, but all I can really do is say what works and what doesn't. Let me know if I can give anything specific back to you that would help.

#20 @ryan
16 years ago

I don't know why the reduced rules won't work. What version of PHP?

#21 @DarkCryst
16 years ago

its php 4.3.1

I'll be clear - the reduced rules work, but they do the same thing as everything else - break on categories.

I'd prefer the ungreedy rules to work (404 is useful). Either way its rather odd.

#22 @ryan
16 years ago

Yes, I'm curious why %category% breaks with the reduced rules. I understand why it breaks with the default rules and the "ungreedy" variants. It should be fine with PHP's PCRE since it can do reluctant, non-greedy matching.

The only option I can see to get %category% working with greedy versions mod_rewrite is to use a subcategory separator other than '/'.

#23 @westi
15 years ago

  • Keywords bg|2nd-opinion bg|dev-feedback bg|reporter-feedback added

Testing on trunk with "/%category%/%year%/%postname%/" works fine for me.

Using: PHP/5.1.2-gentoo with Hardening-Patch on Apache 2.0

Can we tick this one off as completed?

#24 @davidhouse
15 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

Works here too.

Note: See TracTickets for help on using tickets.