.htaccess - Rewrite rules for page and user profile -


i can't figure out how rewrite url

http://localhost/site/page.php?id=[pagetitle]

to

http://localhost/site/page/title

and user profiles

http://localhost/site/profile.php?username=username

to

http://localhost/site/profile/username

this code i'm using:

rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^profile(.*)$ profile.php?username=$1 rewriterule ^(.*)$ page.php?title=$1 

this rewrite input localhost/site/page/title loacalhost/site/page.php?id=[pagetitle]

    rewriterule ^localhost/site/(.+)$ site/page.php?id=$1     rewriterule ^localhost/site/profile/(.+)$ site/profile.php?username=$1 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -