Afficher un message
Vieux 24/12/2007, 01h38   #4
John Bokma
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: mod_rewrite needed

KarlCore <karl@karlcore.com> wrote:

> On Dec 23, 11:55 am, John Bokma <j...@castleamber.com> wrote:
>> KarlCore <k...@karlcore.com> wrote:
>> > I have the current rewrite rule:

>>
>> > RewriteRule foo/(.*)/(.*)/(.*)/(.*)/$ /foo/index.php?$1=$2&$3=$4

>>
>> > I'd like to be able to have an additional - but optional - parameter
>> > at the end, for pagination.

>>
>> The easiest might be to make an additional rule, e.g.:
>>
>> RewriteRule foo/(.*)/(.*)/(.*)/(.*)/(\d+)$
>> /foo/index.php?$1=$2&$3=$4&page=$5
>>
>> (split over 2 lines)

>
> Just to be clear, your proposed solution is to keep the original rule
> and add this one as well?


Yes

You can make one rule, but then your index.php has to be able to handle
the case that page can be empty (e.g. page=). I.e. change the original
rule into:

RewriteRule foo/(.*)/(.*)/(.*)/(.*)/(\d*)$
/foo/index.php?$1=$2&$3=$4&page=$5

And don't add the one I gave earlier.

BTW: I would replace each .* with .+ because now

RewriteRule foo/////$

Also calls your index.php. I am not sure if it can handle that one,
moreover, do you want URLs like that one to be possible.

--
John Bokma http://johnbokma.com/
  Réponse avec citation
 
Page generated in 0,04869 seconds with 9 queries