Wordpress Htaccess - 停止子目录自动重定向到根索引

时间:2014-07-22 15:12:59

标签: php wordpress apache .htaccess

我试图在wordpress上创建一个子目录

http://wpsite.com/codeigniterhttp://wpsite.com/someothersubdir

但是当我转到该网址时,它总是会重定向回到wordpress网站,并且找不到"页面"

这是wordpress root htaccess文件

# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>

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

# END WordPress

如何将子目录与wordpress分开?谢谢

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:0)

在我的情况下,问题出现在子文件夹的htaccess中(为了测试目的,我运行了另一个wordpress)。所以我不得不将子文件夹的.htaccess更改为:

# BEGIN WordPress

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

# END WordPress