-2

I want to Redirect http://www.example.com/?page=1 to http://www.example.com/page/1 using Htaccess.

user3783243
  • 5,368
  • 5
  • 22
  • 41
user8274471
  • 27
  • 1
  • 8

1 Answers1

0

copy & paste this code in .htaccess file in your root directory

To keep the prefix and replace the last part with a query string

RewriteCond %{QUERY_STRING} !^id=
RewriteRule ^root/pages/(.+)$ /root/pages/?id=$1 [L]

The RewriteCond is needed to prevent a rewrite loop.

Mohit Kumar
  • 952
  • 2
  • 7
  • 18