[wp-hackers] .htaccess cleanup

Ryan Boren ryan at boren.nu
Sun May 22 18:24:06 GMT 2005


On Sun, 2005-05-22 at 20:08 +0200, Denis de Bernardy wrote:
> While checking my .htaccess file, I found plenty of things like:
> 
> RewriteRule ^(projects/sem-theme)/trackback/?$ /index.php?pagename=$1&tb=1
> [QSA,L]
> RewriteRule ^(projects/sem-theme)/feed/(feed|rdf|rss|rss2|atom)/?$
> /index.php?pagename=$1&feed=$2 [QSA,L]
> RewriteRule ^(projects/sem-theme)/(feed|rdf|rss|rss2|atom)/?$
> /index.php?pagename=$1&feed=$2 [QSA,L]
> RewriteRule ^(projects/sem-theme)/page/?([0-9]{1,})/?$
> /index.php?pagename=$1&paged=$2 [QSA,L]
> RewriteRule ^(projects/sem-theme)(/[0-9]+)?/?$
> /index.php?pagename=$1&page=$2 [QSA,L]
> 
> One to a page. Given that I intend to use WP as a CMS, I expect the file to
> quickly become huge. Thus, I was wondering, why something like the following
> is not used:
> 
> RewriteRule ^(.+)/trackback/?$ /index.php?pagename=$1&tb=1 [QSA,L]
> RewriteRule ^(.+)/feed/(feed|rdf|rss|rss2|atom)/?$
> /index.php?pagename=$1&feed=$2 [QSA,L]
> RewriteRule ^(.+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?pagename=$1&feed=$2
> [QSA,L]
> RewriteRule ^(.+)/page/?([0-9]{1,})/?$ /index.php?pagename=$1&paged=$2
> [QSA,L]
> RewriteRule ^(.+)(/[0-9]+)?/?$ /index.php?pagename=$1&page=$2 [QSA,L]

These would eclipse all other rules and break links.

RewriteRule ^(.+)(/[0-9]+)?/?$ /index.php?pagename=$1&page=$2 [QSA,L]

This rule would result in infinite redirects since it will match
anything; an internal server error would be issued once MaxRedirects was
reached.

Ryan




More information about the wp-hackers mailing list