.htaccess与根目录中的Wordpress和子目录中的单独安装有关

.htaccess与根目录中的Wordpress和子目录中的单独安装有关,wordpress,.htaccess,Wordpress,.htaccess,我在顶级目录中安装了Wordpress。我试图将Wordpress单独安装在一个子目录中,这是一种“开发环境”,有自己的代码文件和数据库 目前,子目录中的所有URL都有一个404页面未找到错误 .htaccess用于子目录: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /v3 RewriteCond $1 !^(index\.php|robots\.txt) RewriteCond %{REQUEST_FILENAME}

我在顶级目录中安装了Wordpress。我试图将Wordpress单独安装在一个子目录中,这是一种“开发环境”,有自己的代码文件和数据库

目前,子目录中的所有URL都有一个404页面未找到错误

.htaccess用于子目录:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /v3
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^laddercapital\.com$ [NC]
RewriteRule ^(.*)$ http://www.laddercapital.com/$1 [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/?v3/
RewriteRule . /index.php [L]
</IfModule>
# BEGIN WordPress
RewriteEngine On
RewriteBase /v3/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /v3/index.php [L]
# END WordPress

重新启动发动机
重写BASE/v3
1美元^(索引\.php | robots\.txt)
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php[L]
.htaccess用于主目录:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /v3
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^laddercapital\.com$ [NC]
RewriteRule ^(.*)$ http://www.laddercapital.com/$1 [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/?v3/
RewriteRule . /index.php [L]
</IfModule>
# BEGIN WordPress
RewriteEngine On
RewriteBase /v3/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /v3/index.php [L]
# END WordPress

重新启动发动机
RewriteCond%{HTTP_HOST}^laddercapital\.com$[NC]
重写规则^(.*)$http://www.laddercapital.com/$1[R=301,L]
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写条件%{REQUEST_URI}!^/?v3/
重写规则/index.php[L]

想法?

尝试在子目录的
.htaccess
文件中设置
RewriteBase
。例如

RewriteBase /v3/wordpress

请对子目录中的.htaccess尝试以下操作:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /v3
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^laddercapital\.com$ [NC]
RewriteRule ^(.*)$ http://www.laddercapital.com/$1 [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/?v3/
RewriteRule . /index.php [L]
</IfModule>
# BEGIN WordPress
RewriteEngine On
RewriteBase /v3/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /v3/index.php [L]
# END WordPress

来源:

My bad-我错误标记了主目录v子目录.htaccess文件。正如你现在看到的,子目录已经有了重写库…我自己在这里也遇到了一个非常类似的问题:如果能在这里找到答案,那太好了…天哪,这个问题是9个月前的事了,我还以为只是现在…嘘。