Php 如何更改web应用的默认目录访问权限?
当前,当我打开web应用程序的主URL xyz.com时,它会将web应用程序带到xyz.com/abc/index.php 除了我的web应用程序中的“abc”之外,我还有一个名为“ghi”的目录 我希望web应用程序以xyz.com/ghi/index.php而不是xyz.com/abc/index.php打开Php 如何更改web应用的默认目录访问权限?,php,redirect,default,Php,Redirect,Default,当前,当我打开web应用程序的主URL xyz.com时,它会将web应用程序带到xyz.com/abc/index.php 除了我的web应用程序中的“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?使用以下代码在xy
如何实现这一点,以便在浏览器中输入xyz.com时,web应用程序被带到xyz.com/ghi/index.php而不是xyz.com/abc/index.php?使用以下代码在xyz目录中创建一个index.php文件:
<html>
<a href="/ghi">Click Here</a>
</html>
简单地说,把它放在index.php文件后面的第一行
header('location:xyz.com/ghi/index.php');
或者使用Cpanel并重定向到URL我认为您可以(而且应该)通过使用.htaccess文件实现这一目标。。
下面是通过以下方式生成的示例:
希望这对您有所帮助。您能分享您的代码吗?如果没有一些代码示例(这可能在web服务器的配置中),将很难修复
//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]