Rewrite rule with HTACCESS - Changing a link

Posted on 2012-09-14
Last Modified: 2012-09-19
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

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

to become

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

Question by:Valleriani
    LVL 49

    Expert Comment

    by:Julian Hansen
    RewriteRule ^apple/*(.*)$ index.php?id=$1 [L,R,NC]
    LVL 43

    Accepted Solution

    To be exact and just fix Your rule

    RewriteRule ^(a)([^/]+)/(.+)$ /track_folder/index.php?id=$3 [L,QSA]
    LVL 7

    Author Closing Comment

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

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now