1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Rep Power

    How to use mod_rewrite to change URL

    I am not familiar with mod_rewrite at all, as I know I can change URL using htaccess bu can not figure how to do that so I appreciate if anybody can help me with expression that should be placed in htaccess.
    My current URL is

    I would like to make it like this

    Now i have this rule

    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^([^/\.]+)/?$ product.php?id=$1&
    IndexOptions -FancyIndexing

    But server does not return URL in real time, but when I change manually url to desired it returns correct page
    when i type
    it works when I use link it returns

    What am I missing ???

  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    USA (verifiably)
    Rep Power
    Welcome to DevShed Forums, grooveszk.

    You need to edit your PHP files to output the user-friendly URLs. mod_rewrite doesn't change the URLs in your pages. It only changes URLs when one that matches one of the rewrite rules is requested by a user.

    Comments on this post

    • grooveszk agrees
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo