RewriteCond %{QUERY_STRING} !^sessionid=$
Seems like this condition would always fail (or always succeed, depending on how you look at it), unless your URLs are set up to have "sessionid=" as a default parameter all the time, even when it has no value,
and it's your only parameter ever.
Conditions involving the query string have special issues, because the query is treated as a package. Anchors refer to the whole string as a unit, not to individual parameters. So to isolate one parameter independent of its location, you have to say something like
RewriteCond %{QUERY_STRING} (^|&)queryname=value($|&)
Or, if you can't specify what you want for "value" (for example "\d+" or "[a-z]+") express it as [^&]*
The two pairs
(^|&)
and
($|&)
mean "this is either the beginning/end of the whole query string, or there's an ampersand here marking the beginning/end of one parameter".
RewriteCond %{QUERY_STRING} ^(.*)sessionid(.*)$
Ouch. See above about the
(^|&)
formulation instead. Never use .* or .+ in non-final position if you've got any alternative whatsoever.
If you only need "sessionid" to be present, and don't care about its value, you don't need the (.*)$ part at all. And if you're absolutely certain that you will never have another parameter with an overlapping name, like "newsessionid" or "sessionid3", AND no other parameter's value could ever possibly contain "sessionid", you can dispense with the
(^|&)
business and just match the text.
Pro tip: use [ code ] markup inline to avoid unwanted smileys without having to keep disabling them :)
RewriteRule ^/?(.*) /store/index.php [L,R,NE]
--Do you want this to be a 302 temporary redirect? That's the default value of the [R] flag.
--Give the full protocol-plus-domain in all redirect targets, regardless, unless you have a solid reason for omitting it.
--The [NE] flag is not actively harmful, but it's utterly unnecessary since there is nothing in the target that could potentially be escaped. (The query string is unaffected by default.)
--Since you're not capturing, you don't need the (.*) part in the pattern. Use a leading slash only if the rule is lying loose in the config file; any directory context (whether <Directory> section or htaccess) begins with the bare filename. Here it's irrelevant since you're not matching any particular text. Just give the pattern as
.?
without anchors.