我有一个分类搜索表单,链接输出是
http://localhost/wp/?cityid=16
但我想把它改写成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
它不起作用:RewirteRule ^wp/cityid/([0-9]+)$ ?cityid=$1 [L]
它也不起作用(来自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;
}
有什么帮助吗?