如何在没有403错误的情况下更改我的索引目录在另一个子域


how can change my index directory without 403 error in another subdomains?

我有两个子域a.example.com和b.example.com

我需要将我的索引目录从example.com更改为example.com/home/index.php,地址栏中没有/home/,换句话说,如果用户访问example.com/home/或example.com/homeindex.php重定向到example.com,但显示example.com/home/content。

我在example.com htaccess文件中设置了DirectoryIndex/home/index.php,但a.example.com和b.example.com出现错误。

将Apache配置或任何服务器配置文件中的"目录"选项设置为example.com/home

换句话说,我需要从地址中排除我的/home/目录。这是我的htaccess代码: RewriteEngine on RewriteRule ^(.*)$ /home/$1 [NC]

上面的代码example.com显示example.com/home/content。但example.com/home/仍然存在。现在我需要如果用户访问example.com/home/重定向到example.com。或者如果用户访问sample.com/home/另一页重定向到example.com/another-page

尝试以下操作,

RewriteRule ^home/(.*)$ /$1 [L,NC,R]

R标志从内存创建重定向。