WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 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:

Description

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)

comment:1 DD325 years ago

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

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

comment:2 schlafbaum5 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.

comment:3 schlafbaum5 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...

comment:4 ryan5 years ago

  • Owner changed from anonymous to markjaquith

comment:5 nti5 years ago

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

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

to

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

comment:6 nti5 years ago

the wiki syntax breaks the above line. New try:

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

comment:7 schlafbaum5 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.

comment:8 nti5 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 ...

comment:9 schlafbaum5 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

comment:10 ryan5 years ago

  • Component changed from General to Permalinks

comment:11 ryan5 years ago

  • Priority changed from normal to high

comment:12 markjaquith5 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.