Giuseppe
Giuseppe

Reputation: 2103

Basic rewrite of url

I need a rule that rewrites

http://example.com/page.html?page=2

to

http://example.com/page.html/page/2

I already tried this rule:

RewriteRule ^(.*)page=(.*)$ http://example.com/$1/page/$2/

but this does not work! :( Where I'm wrong?

Upvotes: 1

Views: 28

Answers (1)

Adriano
Adriano

Reputation: 58

You can try this one:

RewriteCond %{QUERY_STRING}    page=(\d+) [NC]
RewriteRule (.*)  /$1/page/%1/? [R=301,L]

It should works.

Upvotes: 1

Related Questions