我的网站www.domain.com上有一个子文件夹www.domain.com/subsite/domain/,在子文件夹中有一个wordpress安装。
目前主站点工作正常,我可以查看wordpress索引页面和管理区域,但每当我尝试访问其中一个前端内页时,我都会收到404错误。
主要的htaccess文件是:
RewriteEngine on
Options +FollowSymlinks
#RewriteCond %{HTTP_USER_AGENT} (googlebot|bingbot|Baiduspider) [NC]
#RewriteRule ^wordpress/(.*)$ - [R=403,L]
RewriteCond %{REQUEST_URI} wordpress
RewriteRule (.*) $1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
rewritecond %{http_host} ^domain.com [nc]
RewriteRule ^(.*)$ http://www.domain.com [r=301,nc]
wordpress安装htaccess:
# WPhtc: End Custom htaccess
<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
任何帮助都将非常感激
答案 0 :(得分:1)
将主要的htaccess文件保存为:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^subsite/domain(/|$) - [L,NC]
RewriteCond %{http_host} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.%{http_host}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
<强>更新强>
这应该是您的/subsite/domain/.htaccess
:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subsite/domain/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>