无法访问 localhost/xampp/index。php
Cannot access to localhost/xampp/index.php
我刚刚为 windows 7 安装了 XAMPP,控制面板似乎工作正常,我启动了 MySql 和 Apache,我遇到的问题是,当我在我的浏览器 "Google Chrome" 将我发送到“http://localhost/dashboard/”
当我将 url 更改为“//localhost/xampp/index.php”时,它告诉我:
“找不到对象!
在此服务器上找不到请求的 URL。如果您手动输入 URL,请检查您的拼写并重试。
如果您认为这是服务器错误,请联系站长。
错误 404
本地主机
Apache/2.4.16 (Win32) OpenSSL/1.0.1p PHP/5.6.11
有人可以帮我解决这个问题吗?
谢谢。
好的,创建一个页面 yourpage.html / yourpage.php 无论如何,你必须将所有页面放在 C:\Xampp\htdocs\ dir
的文件夹中
然后尝试访问以下 url:
localhost/yourpage.html
或
localhost/yourpage.php
应该可以。
我认为您应该输入“http://localhost/index.php”,因为在我的 ../htdocs/xampp/ 名为 index.php.
的文件夹中没有这样的文件
因此,您所指的文件可能位于 ../htdocs/index.php 中,要访问它,您需要按 url 作为“http://localhost/index.php ".
谢谢。
在 Xampp 中,默认页面会将您重定向到 /Dashboard 文件夹,因为它正在向浏览器发送 header Location:http://localhost:80/Dashboard
并且浏览器理解并重定向它。
@Sumeet Gavhale 的回答是正确的。而不是 C://Xampp/htdocs 文件夹 xampp 用于在 /htdocs 文件夹中托管内容,所以如果你想查找 C://Xampp/htdocs/index.php
类型 localhost/index.php
(但这会将你重定向到 /htdocs/Dashboard文件夹)。
如果您想更改托管文件夹,您应该编辑 Apache http/https 配置文件(但这取决于您的 OS 和文件系统)。
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). 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 Xampp 的源代码
<?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 :-(
但如果您仍想查看(执行)页面,请在最后一行和倒数第二行前输入“//”。
我刚刚为 windows 7 安装了 XAMPP,控制面板似乎工作正常,我启动了 MySql 和 Apache,我遇到的问题是,当我在我的浏览器 "Google Chrome" 将我发送到“http://localhost/dashboard/”
当我将 url 更改为“//localhost/xampp/index.php”时,它告诉我: “找不到对象!
在此服务器上找不到请求的 URL。如果您手动输入 URL,请检查您的拼写并重试。
如果您认为这是服务器错误,请联系站长。
错误 404
本地主机 Apache/2.4.16 (Win32) OpenSSL/1.0.1p PHP/5.6.11
有人可以帮我解决这个问题吗? 谢谢。
好的,创建一个页面 yourpage.html / yourpage.php 无论如何,你必须将所有页面放在 C:\Xampp\htdocs\ dir
的文件夹中然后尝试访问以下 url:
localhost/yourpage.html
或
localhost/yourpage.php
应该可以。
我认为您应该输入“http://localhost/index.php”,因为在我的 ../htdocs/xampp/ 名为 index.php.
的文件夹中没有这样的文件因此,您所指的文件可能位于 ../htdocs/index.php 中,要访问它,您需要按 url 作为“http://localhost/index.php ".
谢谢。
在 Xampp 中,默认页面会将您重定向到 /Dashboard 文件夹,因为它正在向浏览器发送 header Location:http://localhost:80/Dashboard
并且浏览器理解并重定向它。
@Sumeet Gavhale 的回答是正确的。而不是 C://Xampp/htdocs 文件夹 xampp 用于在 /htdocs 文件夹中托管内容,所以如果你想查找 C://Xampp/htdocs/index.php
类型 localhost/index.php
(但这会将你重定向到 /htdocs/Dashboard文件夹)。
如果您想更改托管文件夹,您应该编辑 Apache http/https 配置文件(但这取决于您的 OS 和文件系统)。
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). 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 Xampp 的源代码
<?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 :-(
但如果您仍想查看(执行)页面,请在最后一行和倒数第二行前输入“//”。