问题
I've just installed xampp-win32-5.5.30 and in xampp control panel both Apache and mysql started without any error but I found:
1)localhost in my browser redirects to another page localhost/dashboard/ and not the xampp start page.
2)localhost/xampp shows the following:
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
In C:\xampp\htdocs\index.php file:
<?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 :-(
Is there something wrong with the installation?
回答1:
Delete that file(index.php), you will get the list of directories and files from htdocs folder.
回答2:
This:
header('Location: '.$uri.'/dashboard/');
Performs redirect to localhost/dashboard/
Everything works as expected, if you clear this file and put some text, like "Hello world", you should see it on http://localhost/
回答3:
Have you checked that your .htaccess
file is properly configured? This is what solved the problem for me. RewriteEngine
is ON and your RewriteBase
should be specified, so if your website directory is within the htdocs
folder your RewriteBase
should be /MyWebsite/
.
回答4:
I too got the same problem.
Always when I try to access the file created in the htdocs, it was getting redirected to localhost/dashboard.
What I did was, I checked all the files present in htdocs. There was a file applications. I opened it and found that it was actually redirecting me to the dashboard.
So, I moved that file from htdocs.
I could access my files from htdocs now without any redirection issues.
回答5:
To solve this problem in windows I have edited two files.
/Windows/System32/drivers/etc/hosts
Add a line at the bottom like:
localhost sitename.local
/xampp/apache/conf/extra/httpd-vhosts.conf
Add at the bottom:
<VirtualHost *:80>
DocumentRoot "C:/xampp/apps/magento/htdocs"
ServerName sitename.local
</VirtualHost>
You may need to change the above to use your correct IP address (localhost), port number, and document root path. Then you will access the site in your browser by typing in sitename.local or whatever you changed it to.
回答6:
In the file /Applications/XAMPP/xamppfiles/etc/httpd.conf change this:
# Virtual hosts
# Include etc/extra/httpd-vhosts.conf
with this:
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
Then, In the file /Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf add with something like this:
<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>
回答7:
As usually problem:
wp_config.php
at your local file -wp_option
after your importing your databasevhost.txt
atxampp/apache/conf/extra/httpd-vhosts.conf
<VirtualHost *:80> DocumentRoot "C:/xampp/apps/magento/htdocs" ServerName sitename.local </VirtualHost>
来源:https://stackoverflow.com/questions/33284095/xampp-localhost-redirects-to-localhost-dashboard