Make WordPress Core

Opened 16 years ago

Closed 16 years ago

Last modified 7 years ago

#7306 closed defect (bug) (fixed)

Error 404 with /index.php/%postname%/ permalink strucutre

Reported by: aarnet's profile aarnet Owned by: markjaquith's profile markjaquith
Milestone: 2.6.1 Priority: normal
Severity: normal Version: 2.6
Component: General Keywords:
Focuses: Cc:

Description

404 error appears on all permalinks when blog uses following permalink structure: /index.php/%postname%/.

Front page with posts shows OK. Clicking any post headings will give 404 error. Also archives (myblog.com/index.php/2008/07/) will give 404 error.

Pages (myblog.com/index.php/page title/) are working OK.

Tried with different themes and they all produce same error. Changing permalink scheme to default will solve problem but that's not an option normally.

My opinion is that bug appeared in V2.6 beta 3.

Change History (20)

#1 @DD32
16 years ago

Appears to be caused by a conflict with the Tag base when using Pathinfo permalinks.

This is the Tag rewrite rule:

'index.php/(.+?)/?$' => string 'index.php?tag=$matches[1]'

Which prevents Postnames from being matched.

One solution is to add category and tag basenames.

#2 @Otto42
16 years ago

Here's where it got broken, in rewrite.php: [8213]

If those two options are blank, then that was supposed to me that the default values are supposed to be used. In that case, the tag_base and category_base would also be blank, and this code down in get_tag_permastruct handled the default value case:

if (empty($this->tag_base))
    $this->tag_structure = $this->front . 'tag/';
else
    $this->tag_structure = $this->tag_base . '/';

By forcing the index.php into the tag and category bases, those values will never be blank if you use index.php in your permalink structure. Thus breaking permalinks for the default case of blank category/tag bases.

Adding a simple "category" and "tag" to those bases fixes it as a temporary solution, but ideally this code needs to be altered to use the default values as well, instead of just whatever get_option returns, which can be blank.

#3 @Otto42
16 years ago

  • Milestone changed from 2.7 to 2.6.1
  • Priority changed from normal to high
  • Severity changed from normal to critical
  • Version set to 2.6

#4 @ryan
16 years ago

  • Owner changed from anonymous to markjaquith

#5 @santosj
16 years ago

Shouldn't this be fixed in trunk first?

#6 @markjaquith
16 years ago

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

(In [8365]) Better solution for #4536. Slashless normalization of tag/category bases. fixes #7306 for trunk. see #4536

#7 @markjaquith
16 years ago

(In [8366]) Better solution for #4536. Slashless normalization of tag/category bases. fixes #7306 for 2.6.1. see #4536

#8 in reply to: ↑ description @randomperson83
16 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Replying to aarnet:

404 error appears on all permalinks when blog uses following permalink structure: /index.php/%postname%/.

Front page with posts shows OK. Clicking any post headings will give 404 error. Also archives (myblog.com/index.php/2008/07/) will give 404 error.

Pages (myblog.com/index.php/page title/) are working OK.

Tried with different themes and they all produce same error. Changing permalink scheme to default will solve problem but that's not an option normally.

My opinion is that bug appeared in V2.6 beta 3.

#9 @randomperson83
16 years ago

I replaced my /wp-includes/rewrite.php file, that did not fix the error. Links such as myblog.com/blog/index.php/anything_here are not working.

#10 @randomperson83
16 years ago

For a demonstration of the error, see my blog: http://www.virtualroadside.com/blog/ ... I'm at work now, so I can't debug it. I'll try looking at it tonight (6pm EST), thanks if you can figure it out before then.

#11 @ryan
16 years ago

Did you force an upgrade. If you didn't replace the version.php, the upgrade that fixes your rewrite rules won't happen. You can either replace version.php with the new one or click "Save Changes" in your Settings->Permalinks page.

#12 @randomperson83
16 years ago

Ah... that did fix it. Didn't realize thats how it worked. Thanks for the quick response! :)

#13 @ryan
16 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

#14 @ryan
16 years ago

Thanks for the confirmation.

#15 @Nunnsby
16 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Upgraded, had the 404 problem, applied the 3 files that are mentioned in 8366 (will update this post there too). Restarted Apache2. Weirdly it asked me to update/upgrade my database. I then went to the settings page, and selected save for the permalinks. Imagine this is the correct procedure, now it just gives me:

Not Found

The requested URL /2008/07/02/getting-out-to-the-ghettos-luanda/ was not found on this server.

It still works when I set to default, as in: http://www.nunnsby.com/?p=123

Have reopened, but just realised this now doesn't really apply to the 404 error anymore, but still an error.

Any ideas?

#16 @Nunnsby
16 years ago

Oh, just thought I would add to the above comment -

Category Base and Tag Base are both blank.

#17 follow-up: @Otto42
16 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Nunnsby: If you're not using "index.php" in your permalink settings, then this doesn't apply to you. Your error sounds like a straightforward .htaccess problem to me. Try the support forums.

#18 in reply to: ↑ 17 @Nunnsby
16 years ago

Replying to Otto42:

Hey Otto42, thanks, okay I was using index.php, and forgot to put it in, so fixed now.

How do I move away from having index.php in my permalinks? I am not using a .htacess file.

#19 @Otto42
16 years ago

  • Priority changed from high to normal
  • Severity changed from critical to normal

Nunnsby: This question is more suited for the support forums, so let's take it over there.

However, the basic answer to your question is that you must use an .htaccess file to avoid requiring index.php in the permalink string.

This ticket was mentioned in Slack in #mobile by jcasariego. View the logs.


7 years ago

Note: See TracTickets for help on using tickets.