简体   繁体   English

无法访问 localhost/xampp/index.php

[英]Cannot access to localhost/xampp/index.php

I just installed XAMPP for windows 7, control panel seems to work fine, I started MySql and Apache, the problem I have is, when I type localhost in my browser "Google Chrome" it sends me to " http://localhost/dashboard/ "我刚刚为 windows 安装了 XAMPP 7,控制面板似乎工作正常,我启动了 MySql 和 Apache,我遇到的问题是,当我在浏览器“Google Chrome”中键入 localhost 时,它会将我发送到“ http://localhost/dashboard /

when I change the url to "//localhost/xampp/index.php", it tells me: "Object not found!当我将 url 更改为“//localhost/xampp/index.php”时,它告诉我:“找不到对象!

The requested URL was not found on this server.在此服务器上找不到请求的 URL。 If you entered the URL manually please check your spelling and try again.如果您手动输入 URL,请检查您的拼写并重试。

If you think this is a server error, please contact the webmaster.如果您认为这是服务器错误,请联系网站管理员。

Error 404错误 404

localhost Apache/2.4.16 (Win32) OpenSSL/1.0.1p PHP/5.6.11"本地主机 Apache/2.4.16 (Win32) OpenSSL/1.0.1p PHP/5.6.11"

anyone can helps me out with this?谁能帮我解决这个问题? Thanks.谢谢。

Ok, Create a page yourpage.html / yourpage.php whatever, you have to put all your pages in a folder in C:\\Xampp\\htdocs\\ dir 好的,创建一个页面yourpage.html / yourpage.php无论如何,你必须将你的所有页面放在C:\\ Xampp \\ htdocs \\ dir中的一个文件夹中

Then try accessing following url: 然后尝试访问以下网址:

localhost/yourpage.html 本地主机/ yourpage.html

or 要么

localhost/yourpage.php 本地主机/ yourpage.php

That should work. 这应该工作。

In Xampp the default page will redirect you to /Dashboard Folder because it is sending the header Location:http://localhost:80/Dashboard to browser and browser understands that and redirects it.在 Xampp 中,默认页面会将您重定向到 /Dashboard 文件夹,因为它正在发送 header Location:http://localhost:80/Dashboard到浏览器,浏览器会理解并重定向它。

The answer by @Sumeet Gavhale is correct. @Sumeet Gavhale 的回答是正确的。 And instead of C://Xampp/htdocs folder xampp use to host contents inside /htdocs folder so if you want to find C://Xampp/htdocs/index.php type localhost/index.php (but that will redirect you to /htdocs/Dashboard folder).而不是 C://Xampp/htdocs 文件夹 xampp 用于托管 /htdocs 文件夹内的内容所以如果你想找到C://Xampp/htdocs/index.php类型localhost/index.php /htdocs/仪表板文件夹)。

If you want to change the hosting folder you should edit the Apache http/https configuration file (but that depends on your OS and file system).如果您想更改托管文件夹,您应该编辑 Apache http/https 配置文件(但这取决于您的操作系统和文件系统)。

Note: The Default Page Word referred in second line of this answer means the document's name in the default documents in your Server (xampp in your case) (for eg: index.htm,index.html, index.php etc).注意:此答案第二行中提到的默认页面字表示服务器默认文档中的文档名称(在您的情况下为 xampp)(例如:index.htm、index.html、index.php 等)。 Will be loaded in your server and will be different in other's case (if they have done that) (index.php in first case (if not edited)).将加载到您的服务器中,并且在其他情况下会有所不同(如果他们这样做了)(index.php 在第一种情况下(如果未编辑))。

Index.php Of Xampp's Source Code Xampp源码索引.php

<?php
if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
    $uri = 'https://';
} else {
    $uri = 'http://';
}
$uri .= $_SERVER['HTTP_HOST'];
header('Location: '.$uri.'/dashboard/');
exit; ?>Something is wrong with the XAMPP installation :-(

But if you still want to view (execute) the page enter "//" in front of last and second last line.但如果您仍想查看(执行)页面,请在最后一行和倒数第二行前输入“//”。

I think you should be entering " http://localhost/index.php ", because there is no such file in my ../htdocs/xampp/ folder called as index.php. 我想你应该输入“ http://localhost/index.php ”,因为我的../htdocs/xampp/文件夹中没有这样的文件,名为index.php。

So may be the file you are referring to is in ../htdocs/index.php and to access it you need to hit the url as " http://localhost/index.php ". 因此,您所指的文件可能位于../htdocs/index.php中,要访问它,您需要将网址命名为“ http://localhost/index.php ”。

Thanks. 谢谢。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM