I want to redirect /index.php?id=1&time=10 to /first-10.
.htaccess:
RewriteEngine On
RewriteCond %{QUERY_STRING} id=1&time=10
RewriteRule ^index\.php$ /first-10/? [L,R=301]
when I access /index.php?id=1&time=10 redirects to /first-10/, but it's a 404 page. Please notice last slash also.
Where is the problem?
You need to internally rewrite it back to its old-original format.
You must use
THE_REQUESTto avoid an infinite loophttp://example.com/index.php?id=1&time=10andhttp://example.com/?id=1&time=10will redirect tohttp://example.com/first-10.http://example.com/first-10will internally rewrite it back to/index.php?id=1&time=10