Let’s say these are the url’s you’re working with:


You would put these lines in your .htaccess for each page you want to redirect

RewriteCond %{QUERY_STRING} ^id=1$
RewriteRule ^page\.php$ http://www.example.com/category/page? [R=301,L]

RewriteCond %{QUERY_STRING} ^id=27$
RewriteRule ^page\.php$ http://www.example.com/category/page27? [R=301,L]

RewriteCond %{QUERY_STRING} ^id=55$
RewriteRule ^page\.php$ http://www.example.com/category/page55? [R=301,L]

Just replace id with the actual variable you’re working with (i.e. cat_id), page with the acutal page name (i.e. photos) and http://www.example.com/category/page27 with the new url

*Note: Do not delete the “?” after the new url