简体   繁体   English

如果网址中没有index.php,example.com / index.php中的首页无法加载

[英]Home page is not loading without index.php in url, example.com/index.php

I am using cakephp , Now the home page shows a white blank screen when I load the root domain name eg: conia.net. 我正在使用cakephp,现在,当我加载根域名(例如conia.net)时,主页显示白色空白屏幕。 But the page is loading when we add index.php to the url eg: conia.net/index.php. 但是,当我们将index.php添加到URL时,页面正在加载,例如:conia.net/index.php。 Please help me to resolve this. 请帮助我解决此问题。

Take a look at the apache documentation here , Directory index directive. 看看这里的apache文档,目录索引指令。 Maybe you are on a host that doesn't allow you access to the main apache config, if so you could try to make a .htaccess file with this config inside. 也许您所在的主机不允许您访问主apache配置,如果这样,您可以尝试使用此配置创建一个.htaccess文件。

You need to enable the mod_rewrite module in your domain, you can find this module in your httpd.conf . 您需要在您的域中启用mod_rewrite模块,您可以在httpd.conf中找到该模块。

Essentially, your domain is ignoring the .htaccess file. 本质上,您的域将忽略.htaccess文件。 I would contact your host about this if you are using a shared hosting service. 如果您使用共享托管服务,我会就此与您的主机联系。

CakePHP already makes use of a .htaccess file to properly route your application, but it's being ignored due to the server settings. CakePHP已经使用.htaccess文件正确路由了您的应用程序,但是由于服务器设置而被忽略。

Try adding this line: 尝试添加以下行:

DirectoryIndex index.php

on top of your .htaccess. 在您的.htaccess之上。 This will load /index.php by default when loading: http://example.com/ 这将加载/index.php默认情况下,当负载: http://example.com/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “ example.com/index.php/page/about/”是好的做法吗? - Is “example.com/index.php/page/about/” good practice? 是否可以将 example.com/index.php?page=abc 重定向到 example.com/abc? - Is it possible to redirect the example.com/index.php?page=abc to example.com/abc? 不需要来自 example.com/{lang}/index.php 的 index.php - Not needing index.php from example.com/{lang}/index.php 将example.com/dashboard.php更改为example.com/index.php?action=dashboard - Change example.com/dashboard.php to example.com/index.php?action=dashboard 为什么 htaccess 重定向到 https://example.com/index.php 而不是特定的子网址? - why htaccess redirect to https://example.com/index.php instead the specific sub-url? 使用,htaccess将example.com?id=12重定向到example.com/index.php?id=12 - using ,htaccess redirect example.com?id=12 to example.com/index.php?id=12 如何将example.com/index.php/lib更改为example.com/lib? - How to change example.com/index.php/lib to example.com/lib? 如何将example.com/forum/index.php重定向到example.com/forum/ - How to redirect example.com/forum/index.php to example.com/forum/ Ubuntu-如何直接将example.com/opencart/index.php定向到http://example.com/和www.example.com? - Ubuntu - How direct example.com/opencart/index.php to http://example.com/ and www.example.com? 如何使用.htaccess将http://example.com/test.php设置为http://example.com/index.php?do=test? - How to make http://example.com/test.php to http://example.com/index.php?do=test using .htaccess?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM