Here is what I have in my .htaccess file.
RewriteEngine on
RewriteCond %{QUERY_STRING} ^(run=[a-z0-9A-z]{13})$
RewriteRule %{QUERY_STRING} \? [L]
All I am doing is Rewriting the QUERY_STRING for all QUERY_STRING similar to run=4f13665700694 and do nothing. A URL example: http://thinkingmonkey.me/runs/?run=4f13665700694. So, the RewriteCond should Match. But the above does not work.
But, the pattern seemed correct. Since, both preg_match & RewriteRule use PCRE - Perl Compatible Regular Expressions.
I tried it using preg_match.
$subject = "run=4f13665700694";
$pattern = "/^(run=[a-z0-9A-z]{13})$/";
echo preg_match($pattern, $subject);
And as excepted the above will output:
1
i.e. a successful match.
I do not understand why. What am I missing here?
RewriteCondshould match, but you'll have to clarify what you're going after with thatRewriteRule, as it won't work as written. – Shane Madden Jan 16 at 3:14run=..part and just redirect the URL to the index there. The URL looks like this:http://thinkingmonkey.me/runs/?run=4f13665700694. So, theRewriteCondshould Match. – ThinkingMonkey Jan 16 at 3:28index.phpinstead. – ThinkingMonkey Jan 16 at 3:32