In-Portal Issue Tracker - In-Portal CMS
Viewing Issue Advanced Details
1026 [In-Portal CMS] Front End bug report always 2011-03-13 18:03 2011-09-19 16:08
Dmitry  
alex  
normal  
closed 5.1.0  
fixed  
 
none 5.1.3-B1  
https://groups.google.com/d/topic/in-portal-bugs/VBP3JwDWNFo/discussion
Fixed ability to show "404 Not Found" page
0
0001026: Impossible to get "404 Not Found" page with Rewrite Listeners
In new rewrite listener engine it's near to impossible to get 404 Not Found page in case if at least one part of url was interpreted by rewrite listener. For example in if have urls in format "/friends/<friend_name>" (friend detail page) and we have "/friends" (friend list). At parsing start we look for "friends" at url start if so, then appropriate FriendRewriteListener begins to parse. If there are no more url parts, then show list. If there is more part, then threat it as friend name and display it's page. In case if friend not found we should normally display "404 Not Found", but instead we do nothing and assuming, that next rewrite listener will take care of that, because it really could do that, who knows.

For example:

http://www.website.com/articles/not_found_article.html and http://www.website.com/articles.html will lead to the same page and Google doesn't like that.


Proposed Solution

To solve this problem I propose to let rewrite listener mark url parts, that are processed by it (part order number). At the end in case if total processed part count doesn't match count part in url we will automatically show 404 Not Found page.
child of 0000098closed  (5.0.1)alex Redo Mod-Rewrite for Better Flexibility 
patch raise_404_on_partial_url_parse_too.patch (6,342) 2011-05-20 04:39
http://tracker.in-portal.org/file_download.php?file_id=1008&type=bug
Issue History
2011-09-19 16:08 alex Note Added: 0003852
2011-09-19 16:08 alex Status resolved => closed
2011-05-23 02:50 alex Note Added: 0003484
2011-05-23 02:50 alex Status reviewed and tested => resolved
2011-05-23 02:50 alex Fixed in Version => 5.1.3-B1
2011-05-23 02:50 alex Resolution open => fixed
2011-05-23 02:50 alex Changeset attached 5.1.x r14342
2011-05-22 20:53 Dmitry Note Added: 0003463
2011-05-22 20:53 Dmitry Assigned To !COMMUNITY => alex
2011-05-22 20:53 Dmitry Status needs testing => reviewed and tested
2011-05-20 04:42 alex Time Estimate Removed 3 =>
2011-05-20 04:42 alex Note Added: 0003441
2011-05-20 04:42 alex Assigned To alex => !COMMUNITY
2011-05-20 04:42 alex Developer => alex
2011-05-20 04:42 alex Status needs work => needs testing
2011-05-20 04:39 alex File Added: raise_404_on_partial_url_parse_too.patch
2011-05-20 03:37 alex Note Added: 0003440
2011-05-20 03:30 alex Note Added: 0003439
2011-05-18 13:22 Dmitry Time Estimate Added 3
2011-05-18 13:22 Dmitry Assigned To => alex
2011-05-18 13:22 Dmitry Status active => needs work
2011-04-04 11:53 Dmitry Target Version Icebox => 5.1.3
2011-03-14 02:10 alex Relationship added child of 0000098
2011-03-13 18:03 Dmitry New Issue
2011-03-13 18:03 Dmitry Reference => https://groups.google.com/d/topic/in-portal-bugs/VBP3JwDWNFo/discussion
2011-03-13 18:03 Dmitry Change Log Message => Fixed ability to show "404 Not Found" page

Notes
(0003439)
alex   
2011-05-20 03:30   
Url parsing issues:
1. there could be duplicate url parts (e.g. url "/test/page/test/another-page" has "test" part listed 2 times but under different position) - we need to keep part index too
2. different rewrite listeners could parse same url part and mark it as parsed (so total parsed part count may be correct, but it won't mean, that all url parts are parsed)

Problems:
Remembering url part original index is a problem, since rewrite listeners usually remove parsed url parts resulting original part indexes to be shifted.


Any ideas?
(0003440)
alex   
2011-05-20 03:37   
We can simplify that problem, by presuming, that parsed url parts are always removed, so no other rewrite listener could get them.

In that case duplicate url part parsing isn't a problem anymore, since 1 part is processed by 1 rewrite listener only and then it's removed. And total processed part count would do the trick.
(0003441)
alex   
2011-05-20 04:42   
Usage is simple:

from your rewrite listener execute this:

$mod_rw_helper =& $this->Application->recallObject('kModRewriteHelper');
/* @var $mod_rw_helper kModRewriteHelper */

$mod_rw_helper->partParsed( 'url-part-that-was-parsed' );


Pass 'rtl' as 2nd parameter, when url parsing in this rewrite listener is done from right to left.
(0003463)
Dmitry   
2011-05-22 20:53   
Reviewed and tested good, please commit!
(0003484)
alex   
2011-05-23 02:50   
Fix committed to 5.1.x branch. Commit Message:

Fixes 0001026: Impossible to get "404 Not Found" page with Rewrite Listeners
(0003852)
alex   
2011-09-19 16:08   
Closing, since 5.1.3 release has been released.