RewriteEngine On
RewriteCond %{REQUEST_URI} !=index.php
RewriteRule ^([^/]*)$ index.php?p=$1 [QSA]