1

I am using a theme that uses posts for multiple pages, and the blog posts goes in a category called "blog", I am using the permalinks setting "/%postname%", and the blog menu url is "/category/blog", how can I rewrite that to "/blog" without breaking the rest of the wp url rewrites?, my htaccess is the normal from wp:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

2 Answers 2

4

You don't have to touch the Apache configuration for this, you can do this all from the WordPress rewrite system. But indeed, your general idea is correct: you should append ?cat=3 (or category_name=blog if you want to be even clearer). Remember that your blog archive can have multiple pages, maybe you want to handle this too.

This is how I would do this from inside WordPress:

add_action( 'init', 'wpse7379_init' );
function wpse7379_init()
{
    add_rewrite_rule(
        'blog(/page/([0-9]+))?/?$',
        'index.php?category_name=blog&paged=$matches[2]',
        'top'
    );
}
0

adding RewriteRule ^blog$ /?cat=3 [NC,N] Seems to do the job.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.