[wp-trac] [WordPress Trac] #20688: Forward slash in custom taxonomy rewrite causes 404s because of (unnecessary?) attachment rule
WordPress Trac
wp-trac at lists.automattic.com
Wed May 16 09:07:57 UTC 2012
#20688: Forward slash in custom taxonomy rewrite causes 404s because of
(unnecessary?) attachment rule
---------------------------+-----------------------------
Reporter: harikaram | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Rewrite Rules | Version: 3.3.2
Severity: normal | Keywords:
---------------------------+-----------------------------
I implement a custom taxonomy with a rewrite that is designed to create
urls like:
"/apps/about/sometag"
{{{
$name = 'apps';
register_taxonomy($name.'-tag', $name.'-post', array(
'label' => ucfirst($name) . ' Tags',
'public' => true,
'has_archive' => true,
'hierarchical' => false,
'update_count_callback' => '_update_post_term_count',
'rewrite' => array('slug' => "$name/about", with_front=>true)
));
}}}
However I was getting a 404 (yes I was flushing the rules) unless I
changed the '/' to say a '-'. Upon inspection of the rules, I found this
one whose precedence was causing the problem:
{{{
'apps/[^/]+/([^/]+)/?$' => 'index.php?attachment=$matches[1]'
}}}
Upon removing it inside the "rewrite_rules_array" hook, the problem was
solved.
It seems odd to me that this generic rule exists and rewrites to an
attachment of all things...
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20688>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list