Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend redirects to 404 #2278

Closed
Taral-Patoliya opened this issue Nov 6, 2015 · 7 comments
Closed

Backend redirects to 404 #2278

Taral-Patoliya opened this issue Nov 6, 2015 · 7 comments

Comments

@Taral-Patoliya
Copy link

When I changes the port to 8080 from 80, and tried to access the backend, it redirected me to 404,
This is due to the isHostBackend() method in Magento\Backend\App\Area\FrontNameResolver
returns false,
The $backendHost and $_SERVER['HTTP_HOST']) are not the same.

@kassner
Copy link
Contributor

kassner commented Nov 6, 2015

I guess this is somehow related to Auto-redirect to Base URL as in #2272

@arkadiych
Copy link
Contributor

Internally tracking - MAGETWO-45105

@danslo
Copy link
Contributor

danslo commented Nov 6, 2015

Can confirm this issue, and fixed it with following diff:

diff --git app/code/Magento/Backend/App/Area/FrontNameResolver.php app/code/Magento/Backend/App/Area/FrontNameResolver.php
index ab4e9eb..a375fb4 100644
--- app/code/Magento/Backend/App/Area/FrontNameResolver.php
+++ app/code/Magento/Backend/App/Area/FrontNameResolver.php
@@ -85,7 +85,7 @@ class FrontNameResolver implements \Magento\Framework\App\Area\FrontNameResolver
     {
         $backendUrl = $this->configInterface->getValue(Store::XML_PATH_UNSECURE_BASE_URL, ScopeInterface::SCOPE_STORE);
         $backendHost = parse_url(trim($backendUrl), PHP_URL_HOST);
-        $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
+        $host = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '';
         return (strcasecmp($backendHost, $host) === 0);
     }
 }

@davidalger
Copy link
Member

Closing as duplicate of #2272

@mazhalai
Copy link
Contributor

@Taral-Patoliya Please try again, this has been fixed in RC2.

@100rabhMisra
Copy link

after installation magento2, it redirected me to 404, not open admin panel ?
how to fix it can you any one tell me ??

@benmarks
Copy link
Contributor

benmarks commented Jun 16, 2016

@100rabhMisra please do not comment on closed issues. Moreover, support questions should be asked on the Magento forums or at Magento SE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants