February 26th, 2013, 05:07 AM
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
RewriteRule ^([^/\.]+)/?$ product.php?id=$1&
But server does not return URL in real time, but when I change manually url to desired it returns correct page
when i type 127.0.0.1/19830-PRODUCT-NAME
it works when I use link it returns
What am I missing ???
February 26th, 2013, 12:30 PM
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