I have a taxonomy search form and the link output is
http://localhost/wp/?cityid=16
But i want it to be rewrited as
http://localhost/wp/cityid/16
.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
</IfModule>
# END WordPress
It didn’t work:
RewirteRule ^wp/cityid/([0-9]+)$ ?cityid=$1 [L]
It didnt work either (from wp codex):
add_action('generate_rewrite_rules', 'geotags_add_rewrite_rules');
function geotags_add_rewrite_rules( $wp_rewrite )
{
$new_rules = array(
'cityid/(.+)' => 'index.php?cityid=' .
$wp_rewrite->preg_index(1) );
//â Add the new rewrite rule into the top of the global rules array
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
}
Any help please?
Try this code:
NOTE: Remember to save permalinks so your new rule is picked up by WP.