Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#1399 closed enhancement (worksforme)

htaccess mod_rewrite rules could be cleaner

Reported by: turnip Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Optimization Keywords:
Focuses: Cc:


Following a discussion on wp-hackers (http://comox.textdrive.com/pipermail/wp-hackers/2005-May/001083.html) it seems that the .htaccess mod_rewrite rules for pages could be cleaned up significantly by using a (page1|page2|page3|etc) syntax instead of having a new set of rules for each and every page. Example:

RewriteRule ^(page1|page2|page3)/trackback/?$ /index.php?pagename=$1&tb=1 [QSA,L]
RewriteRule ^(page1|page2|page3)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?pagename=$1&feed=$2 [QSA,L]
RewriteRule ^(page1|page2|page3)/(feed|rdf|rss|rss2|atom)/?$ /index.php?pagename=$1&feed=$2 [QSA,L]
RewriteRule ^(page1|page2|page3)/page/?([0-9]{1,})/?$ /index.php?pagename=$1&paged=$2 [QSA,L]
RewriteRule ^(page1|page2|page3)/?([0-9]+)?/?$ /index.php?pagename=$1&page=$2 [QSA,L] 

Change History (1)

#1 @Nazgul
12 years ago

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

Rewrite rules have been simplified a lot since this ticket was started.

Note: See TracTickets for help on using tickets.