mod_rewrite clean urls with alphabets

170 Views Asked by At

I was using mod rewrite to create clean urls. I have urls like this :

http://www.sitename.com/viewcategory.php?id=262

I have rewritten successfully my url like this :

http://www.sitename.com/262

With the following mod_rewrite rule

 RewriteEngine On
 RewriteRule ^([a-zA-Z0-9]+)$ viewcategory.php?id=$1
 RewriteRule ^([a-zA-Z0-9]+)/$ viewcategory.php?id=$1 

What i want is to display the category name somthing like this:

http://www.sitename.com/categoryname

Please suggest me if there is a mistake in my rewrite rule or I need to do something else. Thanks and regards.

0

There are 0 best solutions below