I have a Wordpress site I'm developing, which needs to pass parameters in the URL. I've got to the point where www.example.com/stats/?stat-name works - it takes me to my stats-pages.php template, where I can process it.
What I need to do is to clean up the URL so that the ? is removed, and the URL becomes www.example.com/stats/stat-name instead of www.example.com/stats/stats/?stat-name
In my functions.php, I have:
function add_query_vars($aVars) {
$aVars[] = "stats";
return $aVars;
}
// hook add_query_vars function into query_vars
add_filter('query_vars', 'add_query_vars');
In my .htaccess, I have
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^stats/^([A-Za-z0-9]+)/$ /stats=$1 [QSA,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Can anyone help please? Thanks!