【发布时间】:2026-01-20 11:20:05
【问题描述】:
我的 webroot 中有一个名为 Country 的文件夹。我在这个子文件夹中有一个 index.html 页面。如果我输入 domain.com/country,我会得到 domain.com/app/webroot/country/。 如果我在国家后输入“/”,我会得到 domain.com/country/ 这就是我需要的。如何使用 htaccess 从 domain.com/country 重定向到 domain.com/country/
我希望该规则仅适用于国家文件夹。我有以下规则,但它适用于整个网站,我不想要。
RewriteEngine on
# index.php to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
我们将不胜感激。
【问题讨论】: