I want to Redirect http://www.example.com/?page=1 to http://www.example.com/page/1 using Htaccess.
Asked
Active
Viewed 48 times
-2
-
`RewriteEngine On RewriteRule ^page/([^/]*)$ /?page=$1 [L] ` – Masivuye Cokile May 24 '19 at 15:14
1 Answers
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