I want my to reach my website's main page when entering an url like:


However, I can't seem to get it to work with a typical rewrite rule:

RewriteRule ^/blog$ /

I'm always taken to my site's 404 page.

Works fine if I specify a specific file (e.g. "/foo.html") instead of "/", but "/index.php" doesnt't work.

How can I make this work?

  • Do you really want to redirect the browser, or just stay at the same URL but display what would be displayed at the front page? So should the browser address bar show http://example.com/ or http://example.com/blog/? (Use @Jan when you reply in a comment and I get a notification)
    – Jan Fabry
    May 19, 2011 at 9:53
  • @Jan It should show example.com/blog if possible, but I don't mind if it doesn't.
    – futlib
    May 19, 2011 at 10:06
  • So you want the same information at http://example.com/blog/ and at http://example.com/? Or a static page on the latter?
    – Jan Fabry
    May 19, 2011 at 10:13
  • I want the same information.
    – futlib
    May 19, 2011 at 12:59

3 Answers 3


The redirect has to be a 301, not an internal request. Otherwise WordPress will search dor a page named blog.
And you don’t need mod_rewrite.

# Apache 1.3 needs a complete URL
RedirectMatch Permanent ^/blog$ http://example.com/

# Apache 2.x needs just the path
RedirectMatch Permanent ^/blog$ /

What would be at example.com? if your using WordPress as CMS and if you want to display your weblogs at example.com/blog just create static front page. See codex page for more information - Creating a Static Front Page


You can add an extra rewrite rule to WordPress (not to Apache, via the .htaccess file) to make /blog/ render the latest blog posts:

add_action( 'init', 'wpse17663_init' );
function wpse17663_init()
    add_rewrite_rule( 'blog/?$', 'index.php?post_type=post', 'top' );

Flush the rewrite rules after you add this code (by visiting the Permalinks page, for example).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.