Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 481
  • Last Modified:

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!
0
Valleriani
Asked:
Valleriani
1 Solution
 
Julian HansenCommented:
RewriteRule ^apple/*(.*)$ index.php?id=$1 [L,R,NC]
0
 
ravenplCommented:
To be exact and just fix Your rule


RewriteRule ^(a)([^/]+)/(.+)$ /track_folder/index.php?id=$3 [L,QSA]
0
 
VallerianiAuthor Commented:
Thank you. This one worked exactly for all my links.
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now