I'm trying to redirect a url http://domain.com/?p=106 to http://domain.com/?p=110
My .htaccess file looks like this:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^p=106
RewriteRule / http://domain.com/\?p=110 [L,R=301]
But I can't seem to get it to work.
RewriteRule / wouldn't match a request to / in htaccess. The path you compare against is empty in that case (the prefix is stripped in htaccess rewriterule)
According to the docs, you need to check that
Options FollowSymLinks
is enabled before tryingrewrite
in a.htaccess
. Then, you also have to note that the per-directory prefix is automatically removed, which means a pattern with^/
never matches anything (I bet this is why your/
doesn't work).So, in your case, first check
Options FollowSymLinks
and then change theRewriteRule
to be something as covener suggested, or my version: