【问题标题】:XAMPP localhost redirects to localhost/dashboardXAMPP localhost 重定向到 localhost/dashboard
【发布时间】:2016-01-21 21:54:52
【问题描述】:

我刚刚安装了 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 :-(

安装有问题吗?

【问题讨论】:

    标签: xampp


    【解决方案1】:

    我有同样的问题,经过一些实验,我找到了决定。问题出在 .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
    

    我的网站主页正常打开。

    【讨论】:

      【解决方案2】:

      我遇到了同样的问题,我通过删除 htdocs 中名为 index 的文件来修复它。因为那将我重定向到仪表板。

      【讨论】:

        【解决方案3】:

        在文件 /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>
        

        【讨论】:

          【解决方案4】:

          通常的问题:

          • wp_config.php 在您的本地文件中 -wp_option 导入数据库后
          • vhost.txtxampp/apache/conf/extra/httpd-vhosts.conf

            <VirtualHost *:80>
                   DocumentRoot "C:/xampp/apps/magento/htdocs"
                   ServerName sitename.local
            </VirtualHost>
            

          【讨论】:

            【解决方案5】:

            我也遇到了同样的问题。

            当我尝试访问在 htdocs 中创建的文件时,它总是被重定向到 localhost/dashboard。

            我所做的是,我检查了 htdocs 中存在的所有文件。 有一个文件应用程序。我打开它,发现它实际上是在将我重定向到仪表板。

            所以,我从 htdocs 中移动了该文件。

            我现在可以从 htdocs 访问我的文件,而不会出现任何重定向问题。

            【讨论】:

              【解决方案6】:

              您是否检查过您的.htaccess 文件是否配置正确?这就是为我解决问题的方法。 RewriteEngine 为 ON 且应指定您的 RewriteBase,因此如果您的网站目录位于 htdocs 文件夹中,则您的 RewriteBase 应为 /MyWebsite/。

              【讨论】:

                【解决方案7】:

                删除那个文件(index.php),你会从htdocs文件夹中得到目录和文件的列表。

                【讨论】:

                • 对于未来访问的人,点击本地主机时,请按照此获取“索引”页面
                【解决方案8】:

                这个:

                header('Location: '.$uri.'/dashboard/');
                

                执行重定向到 localhost/dashboard/

                一切正常,如果你清除这个文件并输入一些文本,比如“Hello world”,你应该在http://localhost/看到它

                【讨论】:

                • 是的,这是真的,但是我怎样才能进入 XAMPP 起始页,我可以在其中为 MYSQL 数据库设置密码。键入 localhost/security/xamppsecurity.php 会给出找不到对象 错误 404...
                猜你喜欢
                • 2019-03-19
                • 2019-12-10
                • 2015-06-16
                • 2010-10-18
                • 2016-04-07
                • 2018-01-21
                • 1970-01-01
                • 2022-10-20
                • 2012-06-20
                相关资源
                最近更新 更多