我正在使用WordPress网站并在子目录中安装了另一个网站。为子网站(安装在子目录中)的所有子页面发出URL 404问题
它正在加载子网站的目标网页,但只要尝试访问任何网页或发布它就会出现404错误。这个CMS有自己的.htaccess。
Path:
Wordpress: wp/.htaccess
QA: wp/qa/.htaccess
Wordpress .htaccess代码
# 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
QA .htaccess代码
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>
我对重写规则了解不多,所以请帮我解决这个问题。百万谢谢
答案 0 :(得分:2)
尝试将QA .htaccess更改为:
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /qa/
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /qa/index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>