views:

16

answers:

1

i have a rule like this:

RewriteRule ^posts/(.*)/([0-9]*)$ viewupdates.php?username=$1&page=$2 [L]

and match to: http://site.com/posts/username/1

i need to chante to:

http://site.com/username/posts

without trailing slash, and if have more pages /posts/1

A: 

Simply transpose the corresponding parts of the regexp for the latter case:

RewriteRule ^(.*)/posts/([0-9]*)$ viewupdates.php?username=$1&page=$2 [L]

Probably, you also want another rule without the extra "page" specification (for the former case you describe), smth like this:

RewriteRule ^(.*)/posts$ viewupdates.php?username=$1 [L]

or

RewriteRule ^(.*)/posts$ viewupdates.php?username=$1&page=1 [L]

depending on your implementation of the script.

imz
it works thanks!
greenbandit
imz