Dynamic to Static URLs

Discussion in 'Apache' started by onedodd, May 10, 2005.

  1. #1
    Hi,
    I have been trying with absolutely no success to change some dynamic URL's to static URL's by using mod_rewrite.

    Dont know how this would affect anything but I currently have this in my .htaccess so I can use some SSI's on regular .html pages, for including link tables, common footer etc:

    Options Indexes FollowSymLinks Includes
    AddType application/x-httpd-cgi .cgi
    AddType text/x-server-parsed-html .html .htm

    ------------------------------------------------------

    I am trying to change this and other dynamic URL to a static URL mainly for the SE's and getting some hard to index links indexed.


    I want to change this type link:
    *ww.fishingreporters.com/bass-reports/index.php?action=showentries&catid=4

    to something like this:

    *ww.fishingreporters.com/bass-reports/showentries/4.html or how ever it works out.

    I have tried this with nada results.

    RewriteEngine On
    RewriteRule ^/bass-reports/(.*)/(.*).html /bass-reports/index.php?action=$1&catid=$2


    I have tried other ways but I am not experienced with this at all and I am hoping somebody smarter than me can help.

    Thanks Joe
     
    onedodd, May 10, 2005 IP
  2. Gede

    Gede Peon

    Messages:
    141
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I use this:

    RewriteRule ^bali-gallerie-(.*).htm bali-gallerie.php?foto=$1

    in my root, works

    Without the "^/bass-reports-etc" slash at the beginning like you have..

    I suppose that if you for every directory where you have "stuff" make a separate .htaccess without this slash it will work.

    Maybe if you put in this:

    Rewrite Base /

    And leave the slash out at the beginning of your rule it works to...

    Another sample:

    RewriteRule ^your-directory/([0-9]+)\-.+ your-directory/pages.php?id=$1

    I am not smarter then you, but trial and error helps a lot.. :)
     
    Gede, May 10, 2005 IP
  3. onedodd

    onedodd Well-Known Member

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    116
    #3
    I have tried so many different configurations I've lost track. I know none worked so I will keep looking and trying.
    Are there any other server instructions that must be in the .htaccess file other than - RewriteEngine On and RewriteRule ?
    I mean like 'Options +FollowSymLinks' or something. I tried with this and without.

    Thanks For your help too, Joe Dodd
     
    onedodd, May 10, 2005 IP
  4. hedir

    hedir Peon

    Messages:
    80
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    mod rewrite is associated with performance hit. try changing dynamic urls to static ones through changing the script code.
     
    hedir, May 11, 2005 IP