URL Rewrite and Redirect

Discussion in 'Site & Server Administration' started by deedeedum, Mar 5, 2007.

  1. #1
    Hey,

    Have been stuck on this for hours, and hoping somebody can help me out.

    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^([^/]+)\.html$ /index.php?id=$1 [L]

    RewriteCond %{QUERY_STRING} ^id=([^&]+)$
    RewriteRule ^.*$ /%1.html [R=301,L]


    This is supposed to make www.domain.com/1.html work the same as www.domain.com/index.php?id=1, which WORKS.

    However, I would like to do 301 redirects for www.domain.com/index.php?id=1 to www.domain.com/1.html, that THAT DOESN'T WORK.

    What happens when I type in www.domain.com/index.php?id=1 is that I am getting www.domain.com/1.html?id=1

    Just how do I get rid of id=1???????????

    Thanks in advance. And this forum is awesome!
     
    deedeedum, Mar 5, 2007 IP