htaccess Permalink mod_rewrite


This article teaches you how to create a simple htaccess file to make permalink using mod_rewrite. To make PHP permalink or permanent link using Apache HTTP Server’s mod_rewrite is easy. Below is an example to make http://mysite/products.php?section=games&file=hoopy look like http://mysite/products/games/hoopy.html

1. create a .htaccess file using text editor
2. add in the code below:

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^products/([^/]+)/([^/]+).html /products.php?section=$1&file=$2 [NC]

3. save and close the file.
4. put the file under the root of your domain server

And now it’s done! Hope this helps! :)

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Technorati
  • Twitter
  • Yahoo! Bookmarks

  1. No comments yet.
(will not be published)