Link to home
Start Free TrialLog in
Avatar of Valleriani
VallerianiFlag for Sweden

asked on

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!
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

RewriteRule ^apple/*(.*)$ index.php?id=$1 [L,R,NC]
ASKER CERTIFIED SOLUTION
Avatar of ravenpl
ravenpl
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Valleriani

ASKER

Thank you. This one worked exactly for all my links.