Forum Moderators: phranque

Message Too Old, No Replies

Help with some .htaccess rules

.htaccess, problem with rules

         

luismartin

5:31 am on May 18, 2011 (gmt 0)

10+ Year Member



I want to create pagination with .htaccess so that this would be the appearance of the URL:

page 1 would be this way:
www.mydomain.com/game/name-of-game-sef/review/

from page 2 on the URL would change a little:
www.mydomain.com/game/name-of-game-sef/review/2/
www.mydomain.com/game/name-of-game-sef/review/3/
...
www.mydomain.com/game/name-of-game-sef/review/n/

It might also be like this, if the review was specially made for an only platform (PS3, Xbox, etc):
www.mydomain.com/game/sef-name-of-game/ps3/review/3/

These are the rules I created in order to manage these URL's from Apache and redirect the request to the proper php file:

# for pages from 2 on
RewriteRule ^game/([_0-9a-z-]+)/?([_0-9a-z-]+)?/review/([0-9]+)/ reviews.php?idgame=$1&idplatform=$2&page=$3 [L]
# for page 1
RewriteRule ^game/([_0-9a-z-]+)/?([_0-9a-z-]+)?/review/ reviews.php?idgame=$1&idplatform=$2&page=1 [L]


I'm not keen on regular expressions, and only the first page can be displayed. When I click on page 2, 3, etc, it always displays the first one.

I've also tried testing it on a local machine with XAMPP, but in this case no matter what I do, even if I delete .htaccess, it returns a 301 error (Moved permanently) and I can't access index.php

Could somebody please shed a light on this?