首页 文章

子文件wordpress的冲突htaccess

提问于
浏览
3

我有一个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

任何帮助将非常感激

1 回答

  • 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]
    

    UPDATE:

    这应该是你的 /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>
    

相关问题