gpt4 book ai didi

apache - .htaccess 仅将 root ("/") 重定向到子文件夹

转载 作者:行者123 更新时间:2023-12-01 02:57:57 25 4
gpt4 key购买 nike

我有一个这样安排的网站:

/关于

/CSS/

/index/index.php

/js/

/index.php

index.php 使用 PHP 重定向到 index/index.php

我想创建一个 .htaccess 重写规则,以便在访问根目录时,显示/index/index.php 但/about 等保持不变。

最佳答案

如果你有 mod_rewrite 这应该工作:

RewriteEngine on
RewriteRule ^$ /index/index.php [L]

那只会匹配/(它认为是空的)并在内部重定向到/index/index.php

关于apache - .htaccess 仅将 root ("/") 重定向到子文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2220028/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com