网站需要基本url包含index.php才能正常工作
我们正在使用scalr测试我们的系统。我们在文件夹网站需要基本url包含index.php才能正常工作,php,apache,ubuntu,virtualhost,scalr,Php,Apache,Ubuntu,Virtualhost,Scalr,我们正在使用scalr测试我们的系统。我们在文件夹/var/www/subdomain.example.com/public_html中设置了一个站点,其中包含以下virtualhost配置: <VirtualHost *:80> ServerAlias www.{$host} {$server_alias} ServerAdmin {$server_admin} DocumentRoot {$document_root} Se
/var/www/subdomain.example.com/public_html
中设置了一个站点,其中包含以下virtualhost配置:
<VirtualHost *:80>
ServerAlias www.{$host} {$server_alias}
ServerAdmin {$server_admin}
DocumentRoot {$document_root}
ServerName {$host}
ErrorLog {$logs_dir}/http-{$host}-error.log
CustomLog {$logs_dir}/http-{$host}-access.log combined
</VirtualHost>
服务器别名www.{$host}{$server\u alias}
ServerAdmin{$server\u admin}
DocumentRoot{$document_root}
服务器名{$host}
ErrorLog{$logs\u dir}/http-{$host}-error.log
CustomLog{$logs\u dir}/http-{$host}-access.log组合
当我们转到subdomain.example.com
时,它会显示主机的默认消息,例如“欢迎使用Scalr”-但是如果我们转到subdomain.example.com/index.php
站点正在工作。有没有办法让基本url直接指向index.php而不显示它?您尝试过:
DirectoryIndex index.php
关于这方面的更多资源:
就你而言:
<VirtualHost *:80>
# (other directives)
DirectoryIndex index.php
</VirtualHost>
#(其他指令)
DirectoryIndex.php
更新
正如jcjr
所建议的,此指令也可以放在.htaccess
文件中,但请确保您已通过正确的AllowOverride
指令值启用了此方法:
这可能是最好的方法。使用.htaccess文件可能是另一种选择。