我刚刚安装了xampp-win32-5.5.30,在xampp控制面板中,Apache和mysql都没有出现任何错误,但我发现:
1)我的浏览器中的 localhost 重定向到另一个页面 localhost / dashboard / 而不是xampp启动页。
2) localhost / xampp 显示以下内容:
Index of /xampp
[ICO] Name Last modified Size Description
[PARENTDIR] Parent Directory -
Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.5.30 Server at localhost Port 80
在 C:\ xampp \ htdocs \ index.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 :-(
安装有问题吗?
答案 0 :(得分:2)
此:
header('Location: '.$uri.'/dashboard/');
执行重定向到localhost / dashboard /
一切都按预期工作,如果你清除这个文件并放一些文字,比如&#34; Hello world&#34;,你应该在http://localhost/上看到它
答案 1 :(得分:2)
删除该文件(index.php),您将获得htdocs文件夹中的目录和文件列表。
答案 2 :(得分:0)
您是否检查过您的.htaccess
文件配置正确?这就是我解决问题的方法。 RewriteEngine
已启用且您的RewriteBase
应已指定,因此,如果您的网站目录位于htdocs
文件夹中,则RewriteBase
应为/MyWebsite/
。
答案 3 :(得分:0)
我也遇到了同样的问题。
当我尝试访问在htdocs中创建的文件时,它总是被重定向到localhost / dashboard。
我做的是,我检查了htdocs中存在的所有文件。 有一个文件应用程序。我打开它,发现它实际上是将我重定向到仪表板。
所以,我从htdocs移动了该文件。
我现在可以从htdocs访问我的文件而没有任何重定向问题。
答案 4 :(得分:0)
为了在Windows中解决这个问题,我编辑了两个文件。
/窗/ System32下/驱动器/ etc / hosts中
在底部添加一行,如:
localhost sitename.local
/xampp/apache/conf/extra/httpd-vhosts.conf
在底部添加:
<VirtualHost *:80>
DocumentRoot "C:/xampp/apps/magento/htdocs"
ServerName sitename.local
</VirtualHost>
您可能需要更改以上内容以使用正确的IP地址(localhost),端口号和文档根路径。然后,您将通过键入sitename.local或您更改的任何内容在浏览器中访问该站点。
答案 5 :(得分:0)
在文件/Applications/XAMPP/xamppfiles/etc/httpd.conf中更改以下内容:
# Virtual hosts
# Include etc/extra/httpd-vhosts.conf
与此:
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
然后,在文件/Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf中添加以下内容:
<VirtualHost *:80>
ServerName sbyc.byc.local
ServerAlias sbyc.byc.local
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/byc-mineduc01-ges/app"
<Directory "/Applications/XAMPP/xamppfiles/htdocs/byc-mineduc01-ges/app">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/sbyc.byc.local-error_log"
</VirtualHost>
答案 6 :(得分:0)
我有同样的问题,经过一些实验,我找到了决定。问题出在 .htaccess 文件中,该文件位于我站点文件夹的根文件夹中。 .htaccess 文件的内容:
RewriteEngine on
# If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule . /index.php
当我在最后一行中删除 index.php 之前的斜杠时:
RewriteRule . index.php
我的网站首页正常打开。
答案 7 :(得分:-1)
通常的问题:
wp_config.php
在您的本地文件中
-wp_option
导入数据库后 vhost.txt
at xampp/apache/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "C:/xampp/apps/magento/htdocs"
ServerName sitename.local
</VirtualHost>
答案 8 :(得分:-1)
我遇到了同样的问题,我通过在htdocs中删除名为index的文件来解决此问题。因为那将我重定向到仪表板。