Multiple Rewrite Rules in .htaccess To Redirect at desired pages

admin

Administrator
Staff member
I am trying setup a site where i am creating permalinks just like wordpress but specific to the site. So, when a user clicks on article it should should like

Code:
http://www.sitename.com/url-slug

Also when user clicks on directory it should redirect something like this

Code:
http://www.sitename.com/category/category-slug

Similarly, when clicking on sets, users, pages it should redirect respectively like

Code:
http://www.sitename.com/sets/set-slug

http://www.sitename.com/user/user-full-name
http://www.sitename.com/page/page-slug

Following is the code i am using in .htaccess which i am pretty sure is incorrect

Code:
Options +FollowSymLinks
RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule (.*)$ ./single.php?id=$1 
RewriteRule ^category/(.*)/ category.php?id=$1 [L]


Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.sitename.com/$1 [R=301,L]

Could someone guide me where i am going wrong, i need these pages to call their respective pages i.e. single.php, category.php, sets.php, users.php and page.php respectively to fetch and display data. I am a newbie in .htaccess so, any help is appreciated.