Rewrite rule with HTACCESS - Changing a link

I have a current RewriteRule like this for HTACCESS

RewriteRule ^([a]{1})([^/]+)/(.+)$ /track_folder/$3 [L] #big rewrite tracking folder, only A

Which will change something like

http://domain.com/apple/5512-3311/ 
to
http://domain.com/track_folder/5512-3311.php



However, I moved away from static files and I am using MYSQL now with one file. I need something like

http://domain.com/apple/5512-3311/ 

to become

http://domain.com/track_folder/index.php?id=5512-3311


How could I adjust my current rule to do this to redirect always to index.php with a variable?

Thanks!
LVL 7
VallerianiAsked:
Who is Participating?
 
ravenplCommented:
To be exact and just fix Your rule


RewriteRule ^(a)([^/]+)/(.+)$ /track_folder/index.php?id=$3 [L,QSA]
0
 
Julian HansenCommented:
RewriteRule ^apple/*(.*)$ index.php?id=$1 [L,R,NC]
0
 
VallerianiAuthor Commented:
Thank you. This one worked exactly for all my links.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.