need help for .htaccess url rewriting

Discussion in 'Programming' started by sunnyverma1984, Dec 25, 2007.

  1. #1
    i am making a php script and want to rewrite urls in this way

    all profile page

    /username /profile.php?id=username
    /index.html /index.php
    /about.html /about.php
    and all other root html pages to php

    plz help :confused:
     
    sunnyverma1984, Dec 25, 2007 IP
  2. sunnyverma1984

    sunnyverma1984 Well-Known Member

    Messages:
    342
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    120
    #2
    hmmmm 27 views and no one is able to help me
     
    sunnyverma1984, Dec 26, 2007 IP
  3. clogmoney

    clogmoney Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^wiki/(.*)$ /wiki/index.php?title=$1 [PT,L,QSA]
    RewriteRule ^wiki$ /wiki/index.php [PT,L,QSA]
    RewriteRule ^wiki/+$ /wiki/index.php [PT,L,QSA]

    ok the above code would translate /wiki/index.php?title=''bob" to /wiki/bob

    and for the php bit

    AddHandler application/x-httpd-php .php .html .htm

    if not then mod rewrite

    RewriteEngine on
    RewriteRule ^(.*)\.html $1\.php
     
    clogmoney, Dec 26, 2007 IP