WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#4544 closed defect (bug) (invalid)

WP 404s manual rewrites to index.php

Reported by: vinskapur Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.3
Component: General Keywords:
Focuses: Cc:

Description

On one of my sites, the permalink structure is set to /news/%year%/%monthnum%/%day%/%postname%/ and its category base is /news/categories. I would like to add to and uncomplicate some of these rewrites for categories deserving of their own site sections - /music/, /onair/ etc - so I attempted to add the following rewrite in .htaccess as a starting point (before the WP block):

RewriteRule ^(news|onair|events|music)/?$ /index.php?category_name=$1 [QSA,L]

This rewrite actually works on the server side (ie /music/ rewrites to /index.php?category_name=music), but something in WordPress throws up the is_404() flag and it returns a file not found error page. I haven't found that something.

Change History (5)

comment:1 follow-up: foolswisdom7 years ago

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

My guess is that you need to make that rewrite rule external.

Closing as invalid for now.

comment:2 in reply to: ↑ 1 ; follow-up: vinskapur7 years ago

Replying to foolswisdom:

My guess is that you need to make that rewrite rule external.

External how? If you mean external as in separate from WP_Rewrite, it already is a separate rule in .htaccess from the WordPress catch-all block - just WordPress appears to be overriding it regardless.

comment:3 markjaquith7 years ago

You should use WP's interal rewriting engine to avoid these issues.

comment:4 in reply to: ↑ 2 ; follow-up: foolswisdom7 years ago

Replying to vinskapur:

Replying to foolswisdom:

My guess is that you need to make that rewrite rule external.

External how? If you mean external as in separate from WP_Rewrite, it already is a separate rule in .htaccess from the WordPress catch-all block - just WordPress appears to be overriding it regardless.

External rewrite as in:
RewriteRule ^(news|onair|events|music)/?$ /index.php?category_name=$1 [QSA,R,L]

The Rrrr is important.

comment:5 in reply to: ↑ 4 vinskapur7 years ago

Replying to foolswisdom:

The Rrrr is important.

Gosh, that just isn't pretty. I guess I'll have to try and play around with the internal rewrite engine. (I still think it's a defect that said engine is overriding explicit rewrites, mind.)

Note: See TracTickets for help on using tickets.