Possible Duplicate:
Access GET variables with PHP + .htaccess
I am trying write a combination of .htaccess and PHP script to do the following:
If the URL = http://mysite.com/XXXXXXX Redirect to http://mysite.com/subdir/index.php?var=XXXXXXX
Where XXXXXXX is any alphanumeric string 7 characters long without a .php extension.
This is what I have so far,
RewriteEngine On
RewriteRule ^(.*)$ index.php?code=$1
RewriteRule ^subdir/(.*)$ index.php?code=$1 [L,QSA]
Any help would be greatly appreciated.
UPDATE: Thanks for the replies, the link helped but I think where I am having trouble is the condition.
RewriteEngine On
RewriteCondition [HAS 7 ALPHANUM CHARS] <--HERE
RewriteRule ^(.*)$ /subdir/index.php?code=$1 [QSA,L]