You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WordPress站点子目录访问提示404的.htaccess配置问题求助

问题原因

你当前站点根目录的.htaccess规则优先级更高,规则逻辑是:所有请求路径如果不是以/drupal/开头的,都会被内部重写到/drupal/目录下处理,自然不会匹配到你新建的/ecobonus子目录,所以返回404。

修复步骤

第一步:修改根目录.htaccess规则

在原有的重写条件里新增/ecobonus路径的排除规则,修改后的完整根目录.htaccess内容如下:

RewriteEngine On #created by aruba do not touch this file!

#ATTENTION: Remove file index.(php|html|htm)

RewriteBase /

# 新增ecobonus目录的排除规则
RewriteCond %{REQUEST_URI} !^/ecobonus/.*$
RewriteCond %{REQUEST_URI} !^/drupal/.*$

RewriteRule ^(.*)$ /drupal/$1 [L]

第二步:配置ecobonus子目录的独立.htaccess

在/ecobonus子目录下新建.htaccess文件,写入对应程序的重写规则即可。如果你在子目录安装的是WordPress,可直接使用WordPress默认的子目录重写规则:

# 子目录WordPress默认.htaccess规则
RewriteEngine On
RewriteBase /ecobonus/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /ecobonus/index.php [L]

第三步:验证配置

修改保存后清空浏览器缓存,重新访问www.sogenit.com/ecobonus即可正常加载。

内容的提问来源于stack exchange,提问作者AlboSimo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.27 12:27:08