RDK
RDK

Reputation: 4560

Redirect first page of pagination to main page

I have page url with pagination. Parameter category my be different

For exemple: http://domain.com/category?p=1

How can I redirect this url to: http://domain.com/category using .htaccess

Upvotes: 0

Views: 283

Answers (1)

Croises
Croises

Reputation: 18671

With that:

RewriteEngine on 
RewriteCond %{QUERY_STRING}  ^p=1$
RewriteRule ^(.+)$ $1 [R=302,QSD,L]

[QSD] work only since Apache 2.4.0. If it's not your case, use:

 RewriteRule ^(.+)$ $1? [R=302,L]

Change R=302 for R=301 when test work well.

Upvotes: 1

Related Questions