如何更改web应用程序的默认目录访问权限


How to change default directory access for a web app?

当前,当我打开web应用程序的主URL xyz.com时,它会将web应用程序带到xyz.com/abc/index.php。

在我的网络应用程序中,除了"abc"之外,我还有另一个名为"ghi"的目录。

我希望web应用程序使用xyz.com/ghi/index.php而不是xyz.com/abc/index.php打开。

我该如何实现这一点,以便在浏览器中输入xyz.com时,web应用程序被带到xyz.com/ghi/index.php,而不是xyz.com/abc/index.php?

简单地说,把它放在index.php文件后面的第一行

 header('location:xyz.com/ghi/index.php');

或者Cpanel并重定向到URL

我认为使用.htaccess文件可以(也应该)实现这个目标。。以下是通过该工具生成的样本

//Rewrite to www
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com/ghi/index.php[nc]
RewriteRule ^(.*)$ http://www.example.com/ghi/index.php/$1 [r=301,nc]

希望这能有所帮助。。

在xyz目录中创建一个文件index.php,代码如下:

<html>
 <a href="/ghi">Click Here</a>
</html>