Opened 16 years ago
Last modified 6 years ago
#9824 reopened task (blessed)
make better use of stubs when verbose rules should apply
Reported by: | Denis-de-Bernardy | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Rewrite Rules | Keywords: | needs-refresh needs-unit-tests |
Focuses: | Cc: |
Description
Related to:
http://core.trac.wordpress.org/ticket/6603#comment:27
Problem fixed is:
posts show up as www.apexprd.org/page/2 and not /news-and-events/page/2 as it should.
with permalinks set to /something/$postname%/
we arguably don't necessarily need verbose rules here, since there is a stub.
Attachments (6)
Change History (42)
#10
@
14 years ago
In wp-includes/rewrite.php on line 1984.
change code to if ( preg_match("#\A/%(?:postname|category|tag|author)%#", $this->permalink_structure) )
Works on my test. It appears the current regular expression returns looks at the first wildcard and if it is postname, category, tag, or author returns true, forcing verbose page rules. However per discussion on wp-hackers mailing list verbose page rules need not apply in all cases where one of those items is the first wildcard, if preceeded by a static string, such as /blog/%pagename%. My new regular expression specifically looks at the first element in the path and if it is one of those 4 wildcards returns true, otherwise if its some other wildcard or a string like /blog/... returns false ensuring verbose page rules are set only when absolutley necessary.
Sorry I was unable to provide a .diff for this, I could not get the current code to checkout from subversion, some error I have been unable to resolve, so since its a minor fix figured i'd just include it as a comment here to be included in next release hopefully.
#11
@
14 years ago
Attached is a patch that should fix this.
Current code makes the verbose rules judgement based on the first structure tag. This post suggests you should be able to use a static string in front of a string structure tag to prevent verbose rules.
For example, the following permalink custom structure should not trigger verbose rules, but does in WP 3.0.1:
/view/%pagenum%
#13
@
14 years ago
- Keywords has-patch added; needs-patch removed
- Milestone changed from Future Release to 3.1
#19
@
14 years ago
I guess we need to exclude the standard prefixes, e.g. /index.php
without mod_rewrite and /blog
on Multisite. This also fixes the issue in #16041. Uploaded the patch.
#24
@
14 years ago
- Component changed from Rewrite Rules to Performance
- Milestone changed from Future Release to 3.2
I think we should take another swing at this.
#26
@
14 years ago
- Keywords needs-patch added; has-patch removed
- Milestone changed from 3.2 to Future Release
#27
@
13 years ago
- Component changed from Performance to Rewrite Rules
- Milestone changed from Future Release to 3.3
#29
@
13 years ago
Is there something not covered by 9824.3.patch?
#31
follow-up:
↓ 32
@
13 years ago
Looks like it. It doesn't cause any issue in either #16136 or #16041?
The thing I see is that /blog can be changed via a manual edit to the permalink_structure. If we're on the main site of a subdirectory multisite, perhaps we should pop off the first segment? Might need wpmuguru to explain what people may change that to.
#32
in reply to:
↑ 31
@
13 years ago
- Keywords has-patch added; needs-patch removed
Replying to nacin:
Nope.
The thing I see is that /blog can be changed via a manual edit to the permalink_structure. сIf we're on the main site of a subdirectory multisite, perhaps we should pop off the first segment?
Done in 9824.5.patch. Perhaps instead of a hardcoded value, it should be a variable in WP_Rewrite
, like $wp_rewrite->index
?
see also #9825