在根目录下用.htaccess在子目录中安装wordpress

所以我在example.com的根目录下有一个.htaccess文件:

DirectoryIndex index.html index.php <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !\.(png|gif|ico|swf|jpe?g|js|css)$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php?sef_rewrite=1 [L,QSA] </IfModule> 

现在我在example.com/blog/上安装wordpress,但是在那里上传wordpress文件之后,当我访问http://www.example.com/blog/时,页面没有find404错误

我的意思是我应该修改example.com根目录中的.htaccess,或者将请求redirect到/index.php而不是/blog/index.php

这是我添加到根目录中的.htaccess中的行:

 RewriteCond %{REQUEST_URI} !^/blog 

所以整个事情看起来像:

 DirectoryIndex index.html index.php <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !\.(png|gif|ico|swf|jpe?g|js|css)$ RewriteCond %{REQUEST_URI} !^/blog RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php?sef_rewrite=1 [L,QSA] </IfModule> 

但它不起作用。 example.com/blog/仍然是404错误。 我觉得应该是这样的吧?

那么我应该如何修改根目录下的.htaccess来使这个工作? 非常感谢!

原来这是一个权限的事情,我没有在Linux中正确设置。 不是一个.htaccess的问题。 所以这个问题是没有意义的。