I wish to create a category path with pagination. URL's could be as adopted

All pathways should work without or with trailing slash (if at all possible)

/category/entertainment-and-music/

/category/entertainment-and-music/music/

(signifies "music" category "under entertainment and music")

/category/entertainment-and-music/5/

(signifies fifth page for "ing. and music")

/category/entertainment-and-music/music/5/

(signifies fifth page for "ing. and music/music")

I attempted something of that nature but does not work

RewriteRule ^category/(.*)/? /category.php?slug=$1&page=1
RewriteRule ^category/(.*)/(.*)/? /category.php?slug=$1&page=$2

How do i make a move flexible like this?

Thanks ahead of time...

RewriteRule ^category/([A-Za-z0-9_-]+)([/]?)$ /category.php?slug=$1&page=1
RewriteRule ^category/([A-Za-z0-9_-]+)/([0-9]+)([/]?)$ /category.php?slug=$1&page=$2
RewriteRule ^category/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/([0-9]+)([/]?)$ /category.php?slug=$1&subcat=$2&page=$3

First rule should cover cases when they simply specify a category.

Second rule should cover the course having a page provided.

Third rule should cover category, sub-category, and page. I wasn't real obvious how you desired the subcategory populated and so i just authored it as the second argument after slug.

These permit an optional trailing slash.

It appears much like your first regex also matches anything that might be caught because of your second one.

/category/slugname/7/ would match the .* , with $1 set to "slugname/7"

Try something similar to this:

RewriteRule ^category/([^/]*)/? /category.php?slug=$1&page=1
RewriteRule ^category/([^/]*)/(.*)/? /category.php?slug=$1&page=$2

A minimum of, or firm up your matches a little, such as this:

RewriteRule ^category/([a-zA-Z0-9_-]+)/? /category.php?slug=$1&page=1
RewriteRule ^category/([a-zA-Z0-9_-]+)/([0-9]+)/? /category.php?slug=$1&page=$2

That will constrain your slugs to become a minumum of one alphanumeric character, permitting "_" and "-" too, as well as your page amounts would need to be, well, amounts.