NameSilo

Rewrite mod

Spaceship Spaceship
Watch

baris22

Established Member
Impact
1
Hello,

I have got a url like

this is the first page of url
PHP:
category.php?cat=movie

second page is

PHP:
category.php?cat=movie&page=2&sortby=

if i sort it by date it goes like

PHP:
category.php?cat=movie&page=2&sortby=date

I could not figure it out how to do the rewrite.

I managed make one for the first page

PHP:
RewriteRule ^category-(.*)$ category.php?cat=$1 [L,NC]

but i did not know what to do for the other pages.

Thank you for your help.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
How are you going to have the urls as showing?

Also just a note you should use a 301 redirect with such rules to ensure no duplicates occur.
 
0
•••
If I never sort them by anything it is the url:

category name, page number

PHP:
category-movie-2
category-movie-3
category-movie-4

if i sort them by
category name, page number, sort by (date, view, time, alfabetic order)

PHP:
category-movie-2-data
category-movie-2-view

peter@flexiwebhost said:
How are you going to have the urls as showing?

Also just a note you should use a 301 redirect with such rules to ensure no duplicates occur.
 
0
•••
RewriteRule ^category-(.*)-(.*)$ category.php?cat=$1&sortby=$2 [L,NC]
RewriteRule ^category-(.*)-([0-9]+)-(.*)$ category.php?cat=$1&page=$2&sortby=$3 [L,NC]

Those should pretty much do the trick.
 
0
•••
peter@flexiwebhost said:
RewriteRule ^category-(.*)-(.*)$ category.php?cat=$1&sortby=$2 [L,NC]
RewriteRule ^category-(.*)-([0-9]+)-(.*)$ category.php?cat=$1&page=$2&sortby=$3 [L,NC]

Those should pretty much do the trick.

it did not work.

i tried another one which is

PHP:
RewriteRule ^category-(.*)$ category.php?cat=$1 [L,NC]
RewriteRule ^category-(.*)-([0-9]+)$ category.php?cat=$1&page=$2 [L,NC]
RewriteRule ^category-(.*)-([0-9]+)-(.*)$ category.php?cat=$1&page=$2&sortby=$3 [L,NC]

but it did not work either.

this is my code
PHP:
"<a href=\"category-".$cat_name."-".$next_page."-".$sortby."\">Next ".$limit." videos »</a>"

any idea why it is not working?

Ok. sorted.

I just changed the order

PHP:
RewriteRule ^category-(.*)-([0-9]+)-(.*)$ category.php?cat=$1&page=$2&sortby=$3 [L,NC]

RewriteRule ^category-(.*)-([0-9]+)$ category.php?cat=$1&page=$2 [L,NC]

RewriteRule ^category-(.*)$ category.php?cat=$1 [L,NC]
 
0
•••
What about this one ?
PHP:
 RewriteRule ^category-([a-z]+)-([0-9]+)-([a-z]+)$ category.php?cat=$1&page=$2&sortby=$3 [L,NC]

RewriteRule ^category-([a-z]+)-([0-9]+)$ category.php?cat=$1&page=$2 [L,NC]

RewriteRule ^category-([a-z]+)$ category.php?cat=$1 [L,NC]
 
0
•••
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back