Rewrite mod

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
NamecheapNamecheap
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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
Close
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
Close
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
Close
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
Close
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
Close
0
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Member card: see how many threads a member started
The member card now shows a Threads number, right after Posts. The member card is the box that opens when you point at a name. Profile...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back