Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#8076 closed defect (bug) (fixed)

General feed doesn't work with permalink without mod_rewrite

Reported by: schlafbaum Owned by: markjaquith
Milestone: 2.7 Priority: high
Severity: normal Version: 2.7
Component: Permalinks Keywords:
Focuses: Cc:


If I use permalinks starting with /index.php/ the general feed does not work. The link to the feed is correctly given as www.site.com/index.php/feed, but redirects to www.site.com/feed which leads to error 404. Same does index.php?feed=rss2

Config: No .htaccess-file No mod_rewrite Permalink-structure: /index.php/%year%/%monthnum%/%postname%/

Change History (12)

#1 @DD32
10 years ago

For reference, Here's the commit/ticket for Canonical feeds:

[9156]: Canonical Feed URLs, first try. see #7182

#2 @schlafbaum
10 years ago

Using canonical.php from 2.6.3 instead of the one from newest beta works fine, canonical.php from Changeset 9156 does not.

#3 @schlafbaum
10 years ago

Stripping off index.php in row 145 canonical.php causes this error. Commenting it out works fine. Don't know what this does to other feeds...

#4 @ryan
10 years ago

  • Owner changed from anonymous to markjaquith

#5 @nti
10 years ago

Instead of commenting line 145 out change the slash in the regex line 141 from

('#/feed(/[a-z0-9-]*?(/+)?)?$#', '/', $paged_redirectpath?)


('#/feed(a-z0-9-*?(/+)?)?$#', '/', $paged_redirectpath?)

#6 @nti
10 years ago

the wiki syntax breaks the above line. New try:

('#/feed([/a-z0-9-]*?(/+)?)?$#', '/', $paged_redirect['path']);

#7 @schlafbaum
10 years ago

I tried changing line 141 and removing comments in line 145 but this does not work for me: index.php is still disappearing from url, leaving me with 404 on www.site.com/feed.

I don't know, when index.php should be stripped: I tried my working version with /index.php/%year%/%monthnum%/%postname%/ and /%year%/%monthnum%/%postname%/ (with mod_rewrite activated) and all feeds seem to work.

#8 @nti
10 years ago

Do you delete your bowser cache?

The problem is, that the regex in line 141 doesn't match the default feed URI. The default feed has no characters behind the last slash ".../index.php/feed/" but the regex matches after the slash. Therefore the statement in line 145 becomes effective. Changing #/feed(/[a-z0-9-] to #/feed([/a-z0-9-] must work ...

#9 @schlafbaum
10 years ago

yes, I emptied the browser cache. It does not work with preg_replace('#/feed([/a-z0-9-]*?(/+)?)?$#', '/',

The replacement in line 145 is done, however I put the slash outside or inside the brackets. This is done in both cases (did some logging):
After line 137, $paged_redirect['path'] is "site/index.php/feed/"
After line 143, $paged_redirect['path'] is "site/index.php/"
After line 145, $paged_redirect['path'] is "site/"

This is looped once more without /index.php/ Without line 145, it remains "site/index.php" and is not looped

#10 @ryan
10 years ago

  • Component changed from General to Permalinks

#11 @ryan
10 years ago

  • Priority changed from normal to high

#12 @markjaquith
10 years ago

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

(In [9697]) Make Canonical feeds and paging play nice with each other and with PATHINFO URL structures. fixes #8076

Note: See TracTickets for help on using tickets.