From: Ken N. <ke...@co...> - 2005-09-21 12:42:21
|
On Wed, 2005-09-21 at 06:11 -0400, Ken Nordquist wrote: > URL = article3-2.html > > RewriteRule ^article([1-9][0-9]*)\-([1-9][0-9]*).html$ > index.php?module=article&view=$1&%{QUERY_STRING}&page_num=$2& > %{QUERY_STRING} > > Which rewrites to: > > module=article&view=3&page_num=2 > > The caveat at this point is that it needs BOTH the article number and > the page number. It is a relatively simple implementation of Eloi's > short URL hack (which works wonderfully and I wholeheartedly endorse!) After further testing, there is a way to mod_rewrite the URL to default to the first page. ********** RewriteRule ^article([1-9][0-9]*).html$ index.php?module=article&view= $1&%{QUERY_STRING} [L] RewriteRule ^article([1-9][0-9]*)\-([1-9][0-9]*).html$ index.php?module=article&view=$1&%{QUERY_STRING}&page_num=$2&%{QUERY_STRING} [L] ********** The [L] tells mod_rewrite to stop looking for rewrite rules and to apply the current rule. It does work without the [L], but it does eliminate some httpd overhead should mod_rewrite (.htaccess) become a large file. -- Ken Nordquist "Did I Do That?" |