Mod Rewrite .htaccess Changing Dynamic to static

Discussion in 'Apache' started by execute, Dec 11, 2005.

  1. #1
    I'm trying to change my dynamic URLs to static:

    RewriteEngine On
    RewriteBase /

    Options +FollowSymLinks
    #RewriteCond %{QUERY_STRING} ^\&PHPSESSID\=([^&]+)$
    RewriteRule ^index.php\?q\=([^&]+)$ $1\.htm [R=301]
    RewriteRule (a-zA-Z0-9\-+)PHPSESSID\=([^&]+) $1\.htm [R=301,L]

    i also tried:
    RewriteEngine On
    RewriteBase /

    Options +FollowSymLinks
    #RewriteCond %{QUERY_STRING} ^\&PHPSESSID\=([^&]+)$
    RewriteRule index.php\?q\=([^&]+) $1\.htm [R=301]
    RewriteRule (a-zA-Z0-9\-+)PHPSESSID\=([^&]+) $1\.htm [R=301,L]

    i also tried:
    Options +FollowSymLinks
    #RewriteCond %{QUERY_STRING} ^\&PHPSESSID\=([^&]+)$
    RewriteCond %{QUERY_STRING} ^q\=([^&]+)$
    RewriteRule ^$ %1\.htm [R=301]
    #RewriteCond %{QUERY_STRING} ^q\=([^&]+)\&PHPSESSID\=([^&]+)$
    #RewriteRule ^$ %1\.htm [R=301,L]

    Still no luck. It doesnt work in either of my servers, my terrible host or my localhost apache.
    Its not incorrect syntax because there is no 500 errors that i get when i make a syntax error, but I guess its not finding what i told it, i must have wrote it wrong. I commented out some things, because i am not sure if i should use them.

    Any ideas? Oh btw, im also trying to remove any PHPSESSID that might pop up sometimes, just incase php_value session.use_trans_sid 0 this doesnt work.
     
    execute, Dec 11, 2005 IP
  2. execute

    execute Peon

    Messages:
    301
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Nvm, i thought it was if someone entered in browser: http://yourwebsite.com/index.php?page=index it would switch to index.html, but i got it wrong, my syntax was correct, but this means i have to change EVERY link in my form to make it work. So i had it right all along i just didnt know i had to type in .html and shit.

    Btw what is difference between having an R=301 flag, for redirect and not having it?
     
    execute, Dec 12, 2005 IP