anyone know how to do a simple url rewrite?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xanx
    Confirmed User
    • Apr 2002
    • 3711

    #1

    anyone know how to do a simple url rewrite?

    All I want to do is change a URL that looks like this

    /downloads/?dl_cat=3

    to something like

    /downloads/name-of-download/

    I can't seem to get it to work
  • vending_machine
    Confirmed User
    • Jun 2002
    • 1070

    #2
    Code:
    RewriteEngine On
    RewriteRule downloads/?dl_cat=([[:digit:]]+) /downloads/$1/ [R,L]
    Assuming "name of download" in that example is 3? I think that ought to do it..

    Comment

    • SmokeyTheBear
      ►SouthOfHeaven
      • Jun 2004
      • 28609

      #3
      heh i think he wants the opposite of that ( se friendly urls )
      hatisblack at yahoo.com

      Comment

      • BV
        wtf
        • Sep 2001
        • 10914

        #4
        is this kindergarten?

        Comment

        • cezam
          Confirmed User
          • Jun 2003
          • 1363

          #5
          Ok you need to do this:

          Modify your script so that it takes name of the download as a parameter, eg:

          /downloads/?dl_name=name_of_download

          then, edit your .htaccess file:

          Code:
          RewriteEngine On
          RewriteRule downloads/?dl_name=([A-Za-z0-9_-]+)$ /downloads/$1/
          This should work.

          Comment

          • cezam
            Confirmed User
            • Jun 2003
            • 1363

            #6
            sorry i screwed up, the htacces should be:

            Code:
            RewriteEngine On
            RewriteRule  /downloads/([A-Za-z0-9_-]+)/$ downloads/?dl_name=$1

            Comment

            • Linguist
              Confirmed User
              • Apr 2004
              • 1706

              #7
              Originally posted by xanx
              All I want to do is change a URL that looks like this

              /downloads/?dl_cat=3

              to something like

              /downloads/name-of-download/

              I can't seem to get it to work
              Use what everyone else said & dynamically add "name-of-download" as a part of url, so you'd have something like /downloads/3-name-of-download/. Take first # and forward that to /?dl_cat=3. If you're hell bent on that just having /name-of-download then you can do it in mysql and you'd have /?dl_cat=name-of-download and then you'd get id from the database. The first way is easier.
              315-310

              Comment

              Working...