Wordpress Url rewrite doesn't work

on my server i have installed magento,which is in my root directory. then I created a sub-folder named blog in my site’s server. access the blog url is:
Code:

http://example.com/blog or http://example.com/blog/?p=123

when i checked Post name checkbox item http://www.example.com/blog/index.php/sample-post/ in the Permalink Settings part. when i access post. it shows not found. when i unenabled the url rewrite. when view all the post,all are ok.

my server supports the url rewrite.then i created .htaccess(644). put it into blog file and put code:

HTML Code:

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

it still can’t work. why?

Are you using Wordpress or Magento?

If wordpress you need to go Settings > Permalinks and choose Post Name as common setting then it will work…

i using both of them. i do it as your told. but it can’t work.