RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)$ index.php?p=$1 "[L,QSA,B= ?,BNP]"

#RewriteCond %{REQUEST_URI} ^/?index\.php?p=([^/]+)\.txt$
#RewriteRule ^/?index\.php?p=([^/]+)\.txt$ index.php?p=$1 [L] 
