I am trying to use mod_rewrite to keep only the query string in a url, and remove index.php?p=.
For example, this link
http://domain.com/index.php?p=page-name-with-dashes
Into
http://domain.com/page-name-with-dashes.html
All pages are loaded through the control script index.php and the query p=name, like this
<?php
$page = isset($_GET['p']) ? $_GET['p'] : 'home';
...
require_once 'content-' . $page . '.php';
...
?>
I have tried all variants below, but none works - some give 404 some give 500 errors.
#RewriteRule ^index.php?p=(.*) $1/
#RewriteRule ^([^/]+)/?$ /index.php?p=$1 [QSA,L]
#RewriteRule ^(.*)$ index.php?p=$1 [NC,L,QSA]
What am I doing wrong? I don't know much about htaccess rules, so forgive my newbie question.