WordPress网址重写分页

时间:2017-04-26 10:29:04

标签: php wordpress .htaccess

我有这个链接:http://localhost/?trips-page=2 并希望它像这样:http://localhost:90/trips-page/2

在我的functions.php中我有这个

add_action( 'init', 'custom_rewrite_rules' );
function custom_rewrite_rules()
{
    add_rewrite_rule(
        '^trips-page/?([^/]+)/?',
        '?trips-page=$matches[1]',
        'top' );
}

另外,这是我的.htaccess代码

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^^trips-page/?([^/]+)/? /?trips-page=$matches[1] [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

我重新保存了固定链接设置,但它无法正常工作。我错过了什么?

0 个答案:

没有答案