请帮帮我。如何删除“?”在查询字符串url rhino/sub-categories/?category=Hotel
中,如localhost中的'rhino / sub-categories / Hotel'。它被称为自定义数据库中的数据。所以,我想从网址中删除?
。我正在尝试像as-
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /rhino/
RewriteRule ^index\.php$ - [L]
RewriteRule ^sub-categories/([^.]*)$ sub-categories/?category=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /rhino/index.php [L]
</IfModule>
并尝试function.php,如: -
function listen_rewrite_action() {
add_rewrite_tag('%category%','([^/]*)');
add_rewrite_rule('^sub-categories/([^/]+)$','index.php?pagename=sub-categories&category=$matches[1]','top');
add_rewrite_rule('^sub-categories/([^/]+)/page/([^/]+)$', 'index.php?pagename=sub-categories&category=$matches[1]&paged=$matches[2]','top');
}
add_action( 'init', 'listen_rewrite_action' );
语法等等。请帮我解决这个问题。