WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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>
share|improve this question

migrated from stackoverflow.com Jan 20 '11 at 20:31

This question came from our site for professional and enthusiast programmers.

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'
    );
}
share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.